# HG changeset patch # User Pierre-Yves David # Date 2019-10-07 03:36:51 # Node ID 037a8759eda16303aa3ce6513ce556d2c696f2a2 # Parent beed7ce6168130d5d9bd115a8350f3d7d58a02cd sidedatacopies: get and store sidedata in the changelogrevision object The object provide a simple way to access changelog entry, we need it to also bear the sidedata value. Since the sidedata are retrieved at the same time as the revision, we can do that without extra cost. Differential Revision: https://phab.mercurial-scm.org/D6951 diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -268,9 +268,10 @@ class changelogrevision(object): __slots__ = ( r'_offsets', r'_text', + r'_sidedata', ) - def __new__(cls, text): + def __new__(cls, text, sidedata): if not text: return _changelogrevision(extra=_defaultextra) @@ -302,6 +303,7 @@ class changelogrevision(object): self._offsets = (nl1, nl2, nl3, doublenl) self._text = text + self._sidedata = sidedata return self @@ -613,12 +615,13 @@ class changelog(revlog.revlog): ``changelogrevision`` instead, as it is faster for partial object access. """ - c = changelogrevision(self.revision(node)) + c = changelogrevision(*self._revisiondata(node)) return (c.manifest, c.user, c.date, c.files, c.description, c.extra) def changelogrevision(self, nodeorrev): """Obtain a ``changelogrevision`` for a node or revision.""" - return changelogrevision(self.revision(nodeorrev)) + text, sidedata = self._revisiondata(nodeorrev) + return changelogrevision(text, sidedata) def readfiles(self, node): """