D6809: revlog: return sidedata map from `_revisiondata`
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Sat Sep 7 09:28:25 UTC 2019
marmoute created this revision.
marmoute added reviewers: yuja, durin42.
Herald added a reviewer: indygreg.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
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.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D6809
AFFECTED FILES
mercurial/revlog.py
CHANGE DETAILS
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1610,7 +1610,7 @@
treated as raw data when applying flag transforms. 'raw' should be set
to True when generating changegroups or in debug commands.
"""
- 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
@@ -1633,7 +1633,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.
@@ -1644,7 +1644,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
@@ -1653,8 +1653,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
@@ -1665,7 +1666,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
@@ -1715,7 +1716,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.
To: marmoute, yuja, durin42, indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list