# HG changeset patch # User Simon Sapin # Date 2022-01-06 11:46:10 # Node ID 5026a0d37526e9f5539c3aeda28974b04ebc81b5 # Parent faa243f345cc19a432eb0890ab738d7775532234 filelog: add a comment explaining a fast path in filerevisioncopied() Differential Revision: https://phab.mercurial-scm.org/D11964 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 @@ def filerevisioncopied(store, node): 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]