copies: fix an incorrect comment in graftcopies() from recent D9802
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 28 Jan 2021 00:14:15 -0800
changeset 46410 892eb7c5edaa
parent 46409 29e3e46b0a22
child 46414 16c18d5e5dc8
copies: fix an incorrect comment in graftcopies() from recent D9802 I don't think the bit about creating a merge in the filelog was correct. Or at least I couldn't find a case where it happened. Differential Revision: https://phab.mercurial-scm.org/D9899
mercurial/copies.py
--- a/mercurial/copies.py	Wed Jan 27 22:10:57 2021 -0800
+++ b/mercurial/copies.py	Thu Jan 28 00:14:15 2021 -0800
@@ -1229,8 +1229,11 @@
     new_copies = pathcopies(base, ctx)
     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
+    # Extra filtering to drop copy information for files that existed before
+    # the graft. This is to handle the case of grafting a rename onto a commit
+    # that already has the rename. Otherwise the presence of copy information
+    # would result in the creation of an empty commit where we would prefer to
+    # not create one.
     for dest, __ in list(new_copies.items()):
         if dest in parent:
             del new_copies[dest]