changeset 43143:037a8759eda1

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
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 06 Oct 2019 23:36:51 -0400
parents beed7ce61681
children ea230325dc8c
files mercurial/changelog.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changelog.py	Sun Oct 06 23:36:51 2019 -0400
+++ b/mercurial/changelog.py	Sun Oct 06 23:36:51 2019 -0400
@@ -268,9 +268,10 @@
     __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 @@
 
         self._offsets = (nl1, nl2, nl3, doublenl)
         self._text = text
+        self._sidedata = sidedata
 
         return self
 
@@ -613,12 +615,13 @@
         ``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):
         """