Patchwork D10783: revlog: no longer return sidedata from `_revisiondata`

login
register
mail settings
Submitter phabricator
Date May 28, 2021, 10:58 p.m.
Message ID <differential-rev-PHID-DREV-sgpkcljum7l3eei4w27n-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49104/
State Superseded
Headers show

Comments

phabricator - May 28, 2021, 10:58 p.m.
marmoute created this revision.
Herald added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  All users have been migrated.
  
  When they was introduced sidedata where grouped with the actual revision data
  and unpacking one came with the other. Sidedata moved be stored "independently"
  and it no longer make sense to retrieve both at the same time unconditionnaly.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

CHANGE DETAILS




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

Patch

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'