[Commented On] D10783: revlog: no longer return sidedata from `_revisiondata`

baymax (Baymax, Your Personal Patch-care Companion) phabricator at mercurial-scm.org
Fri Jun 4 13:55:09 UTC 2021


baymax added a comment.
baymax updated this revision to Diff 28442.


  ✅ refresh by Heptapod after a successful CI run (🐙 💚)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D10783?vs=28393&id=28442

BRANCH
  default

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

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

AFFECTED FILES
  mercurial/changelog.py
  mercurial/revlog.py
  tests/testlib/ext-sidedata.py

CHANGE DETAILS

diff --git a/tests/testlib/ext-sidedata.py b/tests/testlib/ext-sidedata.py
--- a/tests/testlib/ext-sidedata.py
+++ b/tests/testlib/ext-sidedata.py
@@ -39,11 +39,12 @@
 
 
 def wrap_revisiondata(orig, self, nodeorrev, *args, **kwargs):
-    text, sd = orig(self, nodeorrev, *args, **kwargs)
+    text = orig(self, nodeorrev, *args, **kwargs)
+    sd = self.sidedata(nodeorrev)
     if getattr(self, 'sidedatanocheck', False):
-        return text, sd
+        return text
     if self.hassidedata:
-        return text, sd
+        return text
     if nodeorrev != nullrev and nodeorrev != self.nullid:
         cat1 = sd.get(sidedata.SD_TEST1)
         if cat1 is not None and len(text) != struct.unpack('>I', cat1)[0]:
@@ -52,7 +53,7 @@
         got = hashlib.sha256(text).digest()
         if expected is not None and got != expected:
             raise RuntimeError('sha256 mismatch')
-    return text, sd
+    return text
 
 
 def wrapget_sidedata_helpers(orig, srcrepo, dstrepo):
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1967,7 +1967,7 @@
                 b'use revlog.rawdata(...)'
             )
             util.nouideprecwarn(msg, b'5.2', stacklevel=2)
-        return self._revisiondata(nodeorrev, _df, raw=raw)[0]
+        return self._revisiondata(nodeorrev, _df, raw=raw)
 
     def sidedata(self, nodeorrev, _df=None):
         """a map of extra data related to the changeset but not part of the hash
@@ -1994,23 +1994,16 @@
 
         # fast path the special `nullid` rev
         if node == self.nullid:
-            return b"", {}
+            return b""
 
         # ``rawtext`` is the text as stored inside the revlog. Might be the
         # revision or might need to be processed to retrieve the revision.
         rev, rawtext, validated = self._rawtext(node, rev, _df=_df)
 
-        if self.hassidedata:
-            if rev is None:
-                rev = self.rev(node)
-            sidedata = self._sidedata(rev)
-        else:
-            sidedata = {}
-
         if raw and validated:
             # if we don't want to process the raw text and that raw
             # text is cached, we can exit early.
-            return rawtext, sidedata
+            return rawtext
         if rev is None:
             rev = self.rev(node)
         # the revlog's flag for this revision
@@ -2019,7 +2012,7 @@
 
         if validated and flags == REVIDX_DEFAULT_FLAGS:
             # no extra flags set, no flag processor runs, text = rawtext
-            return rawtext, sidedata
+            return rawtext
 
         if raw:
             validatehash = flagutil.processflagsraw(self, rawtext, flags)
@@ -2032,7 +2025,7 @@
         if not validated:
             self._revisioncache = (node, rev, rawtext)
 
-        return text, sidedata
+        return text
 
     def _rawtext(self, node, rev, _df=None):
         """return the possibly unvalidated rawtext for a revision
@@ -2109,7 +2102,7 @@
 
         _df - an existing file handle to read from. (internal-only)
         """
-        return self._revisiondata(nodeorrev, _df, raw=True)[0]
+        return self._revisiondata(nodeorrev, _df, raw=True)
 
     def hash(self, text, p1, p2):
         """Compute a node hash.
@@ -3109,7 +3102,7 @@
             cachedelta = None
             rawtext = None
             if deltareuse == self.DELTAREUSEFULLADD:
-                text = self._revisiondata(rev)[0]
+                text = self._revisiondata(rev)
                 sidedata = self.sidedata(rev)
 
                 if sidedata_helpers is not None:
@@ -3138,7 +3131,7 @@
 
                 sidedata = None
                 if not cachedelta:
-                    rawtext = self._revisiondata(rev)[0]
+                    rawtext = self._revisiondata(rev)
                     sidedata = self.sidedata(rev)
                 if sidedata is None:
                     sidedata = self.sidedata(rev)
diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -527,7 +527,7 @@
         ``changelogrevision`` instead, as it is faster for partial object
         access.
         """
-        d = self._revisiondata(nodeorrev)[0]
+        d = self._revisiondata(nodeorrev)
         sidedata = self.sidedata(nodeorrev)
         copy_sd = self._copiesstorage == b'changeset-sidedata'
         c = changelogrevision(self, d, sidedata, copy_sd)
@@ -535,7 +535,7 @@
 
     def changelogrevision(self, nodeorrev):
         """Obtain a ``changelogrevision`` for a node or revision."""
-        text = self._revisiondata(nodeorrev)[0]
+        text = self._revisiondata(nodeorrev)
         sidedata = self.sidedata(nodeorrev)
         return changelogrevision(
             self, text, sidedata, self._copiesstorage == b'changeset-sidedata'



To: marmoute, indygreg, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210604/a067b115/attachment-0002.html>


More information about the Mercurial-patches mailing list