mercurial/scmutil.py
changeset 42503 88ba0ff94605
parent 42115 27475ae67676
child 42576 ea6558db1011
--- a/mercurial/scmutil.py	Tue Jun 18 23:19:24 2019 -0700
+++ b/mercurial/scmutil.py	Wed Jun 19 09:59:45 2019 -0700
@@ -1247,6 +1247,28 @@
 
     return getrenamed
 
+def getcopiesfn(repo, endrev=None):
+    if copiesmod.usechangesetcentricalgo(repo):
+        def copiesfn(ctx):
+            if ctx.p2copies():
+                allcopies = ctx.p1copies().copy()
+                # There should be no overlap
+                allcopies.update(ctx.p2copies())
+                return sorted(allcopies.items())
+            else:
+                return sorted(ctx.p1copies().items())
+    else:
+        getrenamed = getrenamedfn(repo, endrev)
+        def copiesfn(ctx):
+            copies = []
+            for fn in ctx.files():
+                rename = getrenamed(fn, ctx.rev())
+                if rename:
+                    copies.append((fn, rename))
+            return copies
+
+    return copiesfn
+
 def dirstatecopy(ui, repo, wctx, src, dst, dryrun=False, cwd=None):
     """Update the dirstate to reflect the intent of copying src to dst. For
     different reasons it might not end with dst being marked as copied from src.