D541: effectflag: detect when diff changed

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sun Oct 1 09:20:53 EDT 2017


martinvonz added inline comments.

INLINE COMMENTS

> lothiraldan wrote in obsutil.py:370-377
> No that doesn't work because if you rebase a changeset, context would change and the diff would be detected as different, that's why we call `_prepare_hunk`

Oops, I didn't mean to drop _prepare_hunk,  I just don't like StopIteration and wanted to make _getdifffiles() a generator instead and simplified a bit too much. The following would probably work, but maybe StopIteration is fine and should get used it :-)

  def _getdifflines(iterdiff):
      """return a cleaned up lines"""
      for lines in iterdiff:
          yield _prepare_hunk(lines)
      while True:
          yield None
  
  leftiter = _getdifflines(leftdiff)
  rightiter = _getdifflines(rightdiff)
  while True:
      left, right = next(leftiter), next(rightiter)
      if (left, right) == (None, None):
          return True
      if left != right:
          return False

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D541

To: lothiraldan, #hg-reviewers
Cc: martinvonz, mercurial-devel


More information about the Mercurial-devel mailing list