Mercurial > hg
changeset 45570:9a3563b46f52
changelog: add a `changes` property on `changelogrevision`
For the sidedata storage we are moving toward "all in one" block containing the
equivalent of a "ChangingFiles" instance. We do various refactoring beforehand
to prepare the usage of theses new data in the code.
Since the object use slots, the "property cache" tricks cannot be used, and we
cache the value manually.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 15 Sep 2020 15:37:32 +0200 |
parents | 64d18e9e8508 |
children | 7543b5072e84 |
files | mercurial/changelog.py |
diffstat | 1 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/changelog.py Tue Sep 22 10:27:35 2020 +0200 +++ b/mercurial/changelog.py Tue Sep 15 15:37:32 2020 +0200 @@ -216,6 +216,7 @@ '_text', '_sidedata', '_cpsd', + '_changes', ) def __new__(cls, text, sidedata, cpsd): @@ -252,6 +253,7 @@ self._text = text self._sidedata = sidedata self._cpsd = cpsd + self._changes = None return self @@ -301,6 +303,20 @@ return decodeextra(raw) @property + def changes(self): + if self._changes is not None: + return self._changes + changes = metadata.ChangingFiles( + touched=self.files or (), + added=self.filesadded or (), + removed=self.filesremoved or (), + p1_copies=self.p1copies or {}, + p2_copies=self.p2copies or {}, + ) + self._changes = changes + return changes + + @property def files(self): off = self._offsets if off[2] == off[3]: