mercurial/copies.py
changeset 46397 f213b250fed0
parent 46302 599d247af600
child 46398 154ded9104f1
--- a/mercurial/copies.py	Fri Jan 22 15:43:06 2021 -0500
+++ b/mercurial/copies.py	Sat Jan 16 02:18:55 2021 +0100
@@ -1220,6 +1220,12 @@
     by merge.update().
     """
     new_copies = pathcopies(base, ctx)
-    _filter(wctx.p1(), wctx, new_copies)
+    parent = wctx.p1()
+    _filter(parent, wctx, new_copies)
+    # extra filtering to drop copy information for files that existed before
+    # the graft (otherwise we would create merge filelog for non-merge commit
+    for dest, __ in list(new_copies.items()):
+        if dest in parent:
+            del new_copies[dest]
     for dst, src in pycompat.iteritems(new_copies):
         wctx[dst].markcopied(src)