D6602: copies: inline _chainandfilter() to prepare for next patch

Martin von Zweigbergk martinvonz at google.com
Thu Jul 4 12:36:39 EDT 2019


Wow, Phabricator decides to send the email almost two full days after the
review was created. Anyone knows what's going on?

On Thu, Jul 4, 2019, 09:13 martinvonz (Martin von Zweigbergk) <
phabricator at mercurial-scm.org> wrote:

> martinvonz created this revision.
> Herald added a subscriber: mercurial-devel.
> Herald added a reviewer: hg-reviewers.
>
> REPOSITORY
>   rHG Mercurial
>
> REVISION DETAIL
>   https://phab.mercurial-scm.org/D6602
>
> AFFECTED FILES
>   mercurial/copies.py
>
> CHANGE DETAILS
>
> diff --git a/mercurial/copies.py b/mercurial/copies.py
> --- a/mercurial/copies.py
> +++ b/mercurial/copies.py
> @@ -107,13 +107,13 @@
>      # This only occurs when a is a descendent of b or visa-versa.
>      return min(limit, a, b)
>
> -def _chainandfilter(src, dst, a, b):
> -    """chain two sets of copies 'a' and 'b' and filter result"""
> +def _filter(src, dst, t):
> +    """filters out invalid copies after chaining"""
>
> -    # When chaining copies in 'a' (from 'src' via some other commit
> 'mid') with
> -    # copies in 'b' (from 'mid' to 'dst'), we can get the different cases
> in the
> -    # following table (not including trivial cases). For example, case 2
> is
> -    # where a file existed in 'src' and remained under that name in 'mid'
> and
> +    # When _chain()'ing copies in 'a' (from 'src' via some other commit
> 'mid')
> +    # with copies in 'b' (from 'mid' to 'dst'), we can get the different
> cases
> +    # in the following table (not including trivial cases). For example,
> case 2
> +    # is where a file existed in 'src' and remained under that name in
> 'mid' and
>      # then was renamed between 'mid' and 'dst'.
>      #
>      # case src mid dst result
> @@ -129,12 +129,6 @@
>      # between 5 and 6, so it includes all cases in its result.
>      # Cases 1, 3, and 5 are then removed by _filter().
>
> -    t = _chain(a, b)
> -    _filter(src, dst, t)
> -    return t
> -
> -def _filter(src, dst, t):
> -    """filters out invalid copies after chaining"""
>      for k, v in list(t.items()):
>          # remove copies from files that didn't exist
>          if v not in src:
> @@ -326,7 +320,8 @@
>      if b.rev() is None:
>          cm = _committedforwardcopies(a, b.p1(), match)
>          # combine copies from dirstate if necessary
> -        copies = _chainandfilter(a, b, cm, _dirstatecopies(b._repo,
> match))
> +        copies = _chain(cm, _dirstatecopies(b._repo, match))
> +        _filter(a, b, copies)
>      else:
>          copies  = _committedforwardcopies(a, b, match)
>      return copies
> @@ -376,8 +371,9 @@
>      else:
>          if debug:
>              repo.ui.debug('debug.copies: search mode: combined\n')
> -        copies = _chainandfilter(x, y, _backwardrenames(x, a,
> match=match),
> -                                 _forwardcopies(a, y, match=match))
> +        copies = _chain(_backwardrenames(x, a, match=match),
> +                        _forwardcopies(a, y, match=match))
> +        _filter(x, y, copies)
>      return copies
>
>  def mergecopies(repo, c1, c2, base):
>
>
>
> To: martinvonz, #hg-reviewers
> Cc: mercurial-devel
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20190704/5a3518a3/attachment.html>


More information about the Mercurial-devel mailing list