Mercurial > hg
changeset 47385:9d9eb22b9b69
revlog: no longer return sidedata from `_revisiondata`
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.
Differential Revision: https://phab.mercurial-scm.org/D10783
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 27 May 2021 03:41:02 +0200 |
parents | fec306b05328 |
children | 0d0fb091c49f |
files | mercurial/changelog.py mercurial/revlog.py tests/testlib/ext-sidedata.py |
diffstat | 3 files changed, 15 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/changelog.py Thu May 27 03:28:15 2021 +0200 +++ b/mercurial/changelog.py Thu May 27 03:41:02 2021 +0200 @@ -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'
--- a/mercurial/revlog.py Thu May 27 03:28:15 2021 +0200 +++ b/mercurial/revlog.py Thu May 27 03:41:02 2021 +0200 @@ -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)
--- a/tests/testlib/ext-sidedata.py Thu May 27 03:28:15 2021 +0200 +++ b/tests/testlib/ext-sidedata.py Thu May 27 03:41:02 2021 +0200 @@ -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):