comparison mercurial/utils/storageutil.py @ 48574: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 24ea3ef35238
children 6000f5b25c9b
comparison
equal deleted inserted replaced
48573:faa243f345cc 48574:5026a0d37526
110 110
111 Returns ``False`` if the file has no copy metadata. Otherwise a 111 Returns ``False`` if the file has no copy metadata. Otherwise a
112 2-tuple of the source filename and node. 112 2-tuple of the source filename and node.
113 """ 113 """
114 if store.parents(node)[0] != sha1nodeconstants.nullid: 114 if store.parents(node)[0] != sha1nodeconstants.nullid:
115 # When creating a copy or move we set filelog parents to null,
116 # because contents are probably unrelated and making a delta
117 # would not be useful.
118 # Conversely, if filelog p1 is non-null we know
119 # there is no copy metadata.
120 # In the presence of merges, this reasoning becomes invalid
121 # if we reorder parents. See tests/test-issue6528.t.
115 return False 122 return False
116 123
117 meta = parsemeta(store.revision(node))[0] 124 meta = parsemeta(store.revision(node))[0]
118 125
119 # copy and copyrev occur in pairs. In rare cases due to old bugs, 126 # copy and copyrev occur in pairs. In rare cases due to old bugs,