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

login
register
mail settings
Submitter phabricator
Date Oct. 3, 2019, 5:56 a.m.
Message ID <differential-rev-PHID-DREV-4ptyp6xnybgu32xjeqn3-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/41936/
State Superseded
Headers show

Comments

phabricator - Oct. 3, 2019, 5:56 a.m.
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




To: marmoute, #hg-reviewers
Cc: mercurial-devel
phabricator - Oct. 9, 2019, 5:19 p.m.
martinvonz added inline comments.

INLINE COMMENTS

> changelog.py:618-624
> +        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)

nit: inconsistent way of calling the `changelogrevision` constructor between these two call sites

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6951/new/

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

To: marmoute, #hg-reviewers
Cc: martinvonz, mercurial-devel
phabricator - Oct. 9, 2019, 5:24 p.m.
marmoute added inline comments.

INLINE COMMENTS

> martinvonz wrote in changelog.py:618-624
> nit: inconsistent way of calling the `changelogrevision` constructor between these two call sites

Is a followup good enough for you ?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6951/new/

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

To: marmoute, #hg-reviewers
Cc: martinvonz, mercurial-devel
phabricator - Oct. 9, 2019, 5:27 p.m.
martinvonz added inline comments.

INLINE COMMENTS

> marmoute wrote in changelog.py:618-624
> Is a followup good enough for you ?

Yes, even leaving it inconsistent is good enough for me :) I don't care that much

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6951/new/

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

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

Patch

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):
         """