Mercurial > hg
changeset 45728:232c88dd89e3
changing-files: add a shorthand property to check for copy relevant info
We are going to reuse this change in more place, so we factor it out first.
Differential Revision: https://phab.mercurial-scm.org/D9197
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 13 Oct 2020 03:23:17 +0200 |
parents | d4c4391aa7f2 |
children | 44d84b726c8a |
files | mercurial/changelog.py mercurial/metadata.py |
diffstat | 2 files changed, 11 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/changelog.py Wed Oct 14 17:51:56 2020 +0200 +++ b/mercurial/changelog.py Tue Oct 13 03:23:17 2020 +0200 @@ -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)
--- a/mercurial/metadata.py Wed Oct 14 17:51:56 2020 +0200 +++ b/mercurial/metadata.py Tue Oct 13 03:23:17 2020 +0200 @@ -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