changeset 48545:5026a0d37526

filelog: add a comment explaining a fast path in filerevisioncopied() Differential Revision: https://phab.mercurial-scm.org/D11964
author Simon Sapin <simon.sapin@octobus.net>
date Thu, 06 Jan 2022 12:46:10 +0100
parents faa243f345cc
children e91aa800ae5b
files mercurial/utils/storageutil.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/utils/storageutil.py	Tue Dec 21 21:26:14 2021 +0100
+++ b/mercurial/utils/storageutil.py	Thu Jan 06 12:46:10 2022 +0100
@@ -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]