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

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Jun 10 17:54:25 UTC 2020


martinvonz updated this revision to Diff 21604.

REPOSITORY
  rHG Mercurial

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

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
@@ -27,10 +27,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
@@ -44,10 +44,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
@@ -61,7 +61,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):
@@ -432,7 +432,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
@@ -490,11 +490,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
 
 
@@ -986,6 +986,6 @@
     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: marmoute, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200610/844af54e/attachment-0001.html>


More information about the Mercurial-patches mailing list