mercurial/copies.py
changeset 43786 421ea5772039
parent 43785 3b039e43a1e6
child 43806 acbb55b8e9dc
--- a/mercurial/copies.py	Wed Nov 13 09:39:44 2019 +0100
+++ b/mercurial/copies.py	Wed Nov 13 20:42:13 2019 +0100
@@ -281,9 +281,24 @@
     iterrevs &= mrset
     iterrevs.update(roots)
     iterrevs.remove(b.rev())
+    revs = sorted(iterrevs)
+    return _combinechangesetcopies(revs, children, b.rev(), revinfo, match)
+
+
+def _combinechangesetcopies(revs, children, targetrev, revinfo, match):
+    """combine the copies information for each item of iterrevs
+
+    revs: sorted iterable of revision to visit
+    children: a {parent: [children]} mapping.
+    targetrev: the final copies destination revision (not in iterrevs)
+    revinfo(rev): a function that return (p1, p2, p1copies, p2copies, removed)
+    match: a matcher
+
+    It returns the aggregated copies information for `targetrev`.
+    """
     all_copies = {}
     alwaysmatch = match.always()
-    for r in sorted(iterrevs):
+    for r in revs:
         copies = all_copies.pop(r, None)
         if copies is None:
             # this is a root
@@ -336,7 +351,7 @@
                 else:
                     newcopies.update(othercopies)
                     all_copies[c] = newcopies
-    return all_copies[b.rev()]
+    return all_copies[targetrev]
 
 
 def _forwardcopies(a, b, base=None, match=None):