D541: effectflag: detect when diff changed

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sat Sep 30 12:54:32 EDT 2017


martinvonz added inline comments.

INLINE COMMENTS

> obsutil.py:341
> +    """Drop all information but the username and patch"""
> +    cleanunk = []
> +    for line in hunk.splitlines():

I think this should be "cleanhunk"

> obsutil.py:360
> +
> +    This is a first and basic implementation, with many shortcoming.
> +    """

I see this as an argument against storing it in the obsmarker. Can we remove all shortcomings before it's no longer experimental?

But, as I said before, the feature is experimental, so we have some time to decide whether to calculate it at obsmarker creation time or on the fly (possibly with caching).

> obsutil.py:370-377
> +    left, right = (0, 0)
> +    while None not in (left, right):
> +        left = _getdifflines(leftdiff)
> +        right = _getdifflines(rightdiff)
> +
> +        if left != right:
> +            return False

I haven't tested this, but I think the following would remove the need for _getdifflines():

  leftiter = itertools.chain(leftdiff, itertools.repeat(None))
  rightiter = itertools.chain(rightdiff, itertools.repeat(None))
  while True:
      left, right = next(leftiter), next(rightiter)
      if left is None and right is 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