revlog: return sidedata map from `_revisiondata`
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 03 Sep 2019 22:54:04 +0200
changeset 42981 35ab2c1a58aa
parent 42980 0d1272783f24
child 42982 9d62f9fa332f
revlog: return sidedata map from `_revisiondata` Nothing extra any side data yet. However, it will happens in the future. So we better prepare the callers of the `_revisiondata` to deal with it. Differential Revision: https://phab.mercurial-scm.org/D6809
mercurial/revlog.py
--- a/mercurial/revlog.py	Tue Sep 03 22:36:27 2019 +0200
+++ b/mercurial/revlog.py	Tue Sep 03 22:54:04 2019 +0200
@@ -1614,7 +1614,7 @@
             msg = ('revlog.revision(..., raw=True) is deprecated, '
                    'use revlog.rawdata(...)')
             util.nouideprecwarn(msg, '5.2', stacklevel=2)
-        return self._revisiondata(nodeorrev, _df, raw=raw)
+        return self._revisiondata(nodeorrev, _df, raw=raw)[0]
 
     def sidedata(self, nodeorrev, _df=None):
         """a map of extra data related to the changeset but not part of the hash
@@ -1637,7 +1637,7 @@
 
         # fast path the special `nullid` rev
         if node == nullid:
-            return ""
+            return "", {}
 
         # The text as stored inside the revlog. Might be the revision or might
         # need to be processed to retrieve the revision.
@@ -1648,7 +1648,7 @@
         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
+            return rawtext, {}
         if rev is None:
             rev = self.rev(node)
         # the revlog's flag for this revision
@@ -1657,8 +1657,9 @@
 
         if validated and flags == REVIDX_DEFAULT_FLAGS:
             # no extra flags set, no flag processor runs, text = rawtext
-            return rawtext
-
+            return rawtext, {}
+
+        sidedata = {}
         if raw:
             validatehash = self._processflagsraw(rawtext, flags)
             text = rawtext
@@ -1669,7 +1670,7 @@
         if not validated:
             self._revisioncache = (node, rev, rawtext)
 
-        return text
+        return text, sidedata
 
     def _rawtext(self, node, rev, _df=None):
         """return the possibly unvalidated rawtext for a revision
@@ -1719,7 +1720,7 @@
 
         _df - an existing file handle to read from. (internal-only)
         """
-        return self._revisiondata(nodeorrev, _df, raw=True)
+        return self._revisiondata(nodeorrev, _df, raw=True)[0]
 
     def hash(self, text, p1, p2):
         """Compute a node hash.