D541: effectflag: detect when diff changed
lothiraldan (Boris Feld)
phabricator at mercurial-scm.org
Sun Oct 1 09:46:10 EDT 2017
lothiraldan marked an inline comment as done.
lothiraldan added inline comments.
INLINE COMMENTS
> martinvonz wrote in obsutil.py:370-377
> 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
I've updated the patch with using next with a default value, tell me if it's better.
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