D6951: sidedatacopies: get and store sidedata in the changelogrevision object

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Thu Oct 3 05:56:10 UTC 2019


marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6951

AFFECTED FILES
  mercurial/changelog.py

CHANGE DETAILS

diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -245,9 +245,10 @@
     __slots__ = (
         r'_offsets',
         r'_text',
+        r'_sidedata',
     )
 
-    def __new__(cls, text):
+    def __new__(cls, text, sidedata):
         if not text:
             return _changelogrevision(extra=_defaultextra)
 
@@ -279,6 +280,7 @@
 
         self._offsets = (nl1, nl2, nl3, doublenl)
         self._text = text
+        self._sidedata = sidedata
 
         return self
 
@@ -582,7 +584,7 @@
         ``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,
@@ -594,7 +596,8 @@
 
     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):
         """



To: marmoute, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list