[Updated] [+ ] D9197: changing-files: add a shorthand property to check for copy relevant info
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Wed Oct 14 23:47:34 UTC 2020
marmoute updated this revision to Diff 23214.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D9197?vs=23185&id=23214
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D9197/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D9197
AFFECTED FILES
mercurial/changelog.py
mercurial/metadata.py
CHANGE DETAILS
diff --git a/mercurial/metadata.py b/mercurial/metadata.py
--- a/mercurial/metadata.py
+++ b/mercurial/metadata.py
@@ -75,6 +75,16 @@
and self.copied_from_p2 == other.copied_from_p2
)
+ @property
+ def has_copies_info(self):
+ return bool(
+ self.removed
+ or self.merged
+ or self.salvaged
+ or self.copied_from_p1
+ or self.copied_from_p2
+ )
+
@util.propertycache
def added(self):
"""files actively added in the changeset
diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -583,13 +583,7 @@
flags = 0
sidedata = None
if self._copiesstorage == b'changeset-sidedata':
- if (
- files.removed
- or files.merged
- or files.salvaged
- or files.copied_from_p1
- or files.copied_from_p2
- ):
+ if files.has_copies_info:
flags |= flagutil.REVIDX_HASCOPIESINFO
sidedata = metadata.encode_files_sidedata(files)
To: marmoute, #hg-reviewers
Cc: pulkit, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20201014/c07394a2/attachment-0002.html>
More information about the Mercurial-patches
mailing list