Patchwork D9899: copies: fix an incorrect comment in graftcopies() from recent D9802

login
register
mail settings
Submitter phabricator
Date Jan. 28, 2021, 8:19 a.m.
Message ID <differential-rev-PHID-DREV-mzui2jxoikkmv4xkzfvx-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48210/
State Superseded
Headers show

Comments

phabricator - Jan. 28, 2021, 8:19 a.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9899

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -1221,8 +1221,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]