Patchwork D11964: filelog: add a comment explaining a fast path in filerevisioncopied()

login
register
mail settings
Submitter phabricator
Date Jan. 6, 2022, 6:57 p.m.
Message ID <differential-rev-PHID-DREV-4ypmvxs2d6g7a6ls6zbd-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50288/
State New
Headers show

Comments

phabricator - Jan. 6, 2022, 6:57 p.m.
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/utils/storageutil.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/utils/storageutil.py b/mercurial/utils/storageutil.py
--- a/mercurial/utils/storageutil.py
+++ b/mercurial/utils/storageutil.py
@@ -112,6 +112,13 @@ 
     2-tuple of the source filename and node.
     """
     if store.parents(node)[0] != sha1nodeconstants.nullid:
+        # When creating a copy or move we set filelog parents to null,
+        # because contents are probably unrelated and making a delta
+        # would not be useful.
+        # Conversely, if filelog p1 is non-null we know
+        # there is no copy metadata.
+        # In the presence of merges, this reasoning becomes invalid
+        # if we reorder parents. See tests/test-issue6528.t.
         return False
 
     meta = parsemeta(store.revision(node))[0]