[Updated] D8595: copies: make _chain() and _filter() public

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sat Jun 6 01:37:48 UTC 2020


martinvonz edited the summary of this revision.
martinvonz updated this revision to Diff 21561.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8595?vs=21524&id=21561

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8595/new/

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

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
@@ -30,10 +30,10 @@
 from .utils import stringutil
 
 
-def _filter(src, dst, t):
+def filter(src, dst, t):
     """filters out invalid copies after chaining"""
 
-    # When _chain()'ing copies in 'a' (from 'src' via some other commit 'mid')
+    # 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
@@ -47,10 +47,10 @@
     #   5   -   x   y    -
     #   6   x   x   y   x->y
     #
-    # _chain() takes care of chaining the copies in 'a' and 'b', but it
+    # chain() takes care of chaining the copies in 'a' and 'b', but it
     # cannot tell the difference between cases 1 and 2, between 3 and 4, or
     # between 5 and 6, so it includes all cases in its result.
-    # Cases 1, 3, and 5 are then removed by _filter().
+    # Cases 1, 3, and 5 are then removed by filter().
 
     for k, v in list(t.items()):
         # remove copies from files that didn't exist
@@ -64,7 +64,7 @@
             del t[k]
 
 
-def _chain(prefix, suffix):
+def chain(prefix, suffix):
     """chain two sets of copies 'prefix' and 'suffix'"""
     result = prefix.copy()
     for key, value in pycompat.iteritems(suffix):
@@ -435,7 +435,7 @@
     if b.rev() is None:
         cm = _committedforwardcopies(a, b.p1(), base, match)
         # combine copies from dirstate if necessary
-        copies = _chain(cm, _dirstatecopies(b._repo, match))
+        copies = chain(cm, _dirstatecopies(b._repo, match))
     else:
         copies = _committedforwardcopies(a, b, base, match)
     return copies
@@ -493,11 +493,11 @@
         base = None
         if a.rev() != node.nullrev:
             base = x
-        copies = _chain(
+        copies = chain(
             _backwardrenames(x, a, match=match),
             _forwardcopies(a, y, base, match=match),
         )
-    _filter(x, y, copies)
+    filter(x, y, copies)
     return copies
 
 
@@ -989,7 +989,7 @@
     by merge.update().
     """
     new_copies = pathcopies(base, ctx)
-    _filter(wctx.p1(), wctx, new_copies)
+    filter(wctx.p1(), wctx, new_copies)
     for dst, src in pycompat.iteritems(new_copies):
         wctx[dst].markcopied(src)
 



To: martinvonz, #hg-reviewers, indygreg
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200606/e0bbd504/attachment-0001.html>


More information about the Mercurial-patches mailing list