# HG changeset patch # User Pierre-Yves David # Date 1600177052 -7200 # Node ID 9a3563b46f528598b679cd61fc59f0b2a12f7aa0 # Parent 64d18e9e8508e96e006cf8432020bb80b95d955c 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. diff -r 64d18e9e8508 -r 9a3563b46f52 mercurial/changelog.py --- 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]: