##// END OF EJS Templates
revlog: no longer return sidedata from `_revisiondata`...
marmoute -
r48177:9d9eb22b default
parent child Browse files
Show More
@@ -527,7 +527,7 b' class changelog(revlog.revlog):'
527 527 ``changelogrevision`` instead, as it is faster for partial object
528 528 access.
529 529 """
530 d = self._revisiondata(nodeorrev)[0]
530 d = self._revisiondata(nodeorrev)
531 531 sidedata = self.sidedata(nodeorrev)
532 532 copy_sd = self._copiesstorage == b'changeset-sidedata'
533 533 c = changelogrevision(self, d, sidedata, copy_sd)
@@ -535,7 +535,7 b' class changelog(revlog.revlog):'
535 535
536 536 def changelogrevision(self, nodeorrev):
537 537 """Obtain a ``changelogrevision`` for a node or revision."""
538 text = self._revisiondata(nodeorrev)[0]
538 text = self._revisiondata(nodeorrev)
539 539 sidedata = self.sidedata(nodeorrev)
540 540 return changelogrevision(
541 541 self, text, sidedata, self._copiesstorage == b'changeset-sidedata'
@@ -1967,7 +1967,7 b' class revlog(object):'
1967 1967 b'use revlog.rawdata(...)'
1968 1968 )
1969 1969 util.nouideprecwarn(msg, b'5.2', stacklevel=2)
1970 return self._revisiondata(nodeorrev, _df, raw=raw)[0]
1970 return self._revisiondata(nodeorrev, _df, raw=raw)
1971 1971
1972 1972 def sidedata(self, nodeorrev, _df=None):
1973 1973 """a map of extra data related to the changeset but not part of the hash
@@ -1994,23 +1994,16 b' class revlog(object):'
1994 1994
1995 1995 # fast path the special `nullid` rev
1996 1996 if node == self.nullid:
1997 return b"", {}
1997 return b""
1998 1998
1999 1999 # ``rawtext`` is the text as stored inside the revlog. Might be the
2000 2000 # revision or might need to be processed to retrieve the revision.
2001 2001 rev, rawtext, validated = self._rawtext(node, rev, _df=_df)
2002 2002
2003 if self.hassidedata:
2004 if rev is None:
2005 rev = self.rev(node)
2006 sidedata = self._sidedata(rev)
2007 else:
2008 sidedata = {}
2009
2010 2003 if raw and validated:
2011 2004 # if we don't want to process the raw text and that raw
2012 2005 # text is cached, we can exit early.
2013 return rawtext, sidedata
2006 return rawtext
2014 2007 if rev is None:
2015 2008 rev = self.rev(node)
2016 2009 # the revlog's flag for this revision
@@ -2019,7 +2012,7 b' class revlog(object):'
2019 2012
2020 2013 if validated and flags == REVIDX_DEFAULT_FLAGS:
2021 2014 # no extra flags set, no flag processor runs, text = rawtext
2022 return rawtext, sidedata
2015 return rawtext
2023 2016
2024 2017 if raw:
2025 2018 validatehash = flagutil.processflagsraw(self, rawtext, flags)
@@ -2032,7 +2025,7 b' class revlog(object):'
2032 2025 if not validated:
2033 2026 self._revisioncache = (node, rev, rawtext)
2034 2027
2035 return text, sidedata
2028 return text
2036 2029
2037 2030 def _rawtext(self, node, rev, _df=None):
2038 2031 """return the possibly unvalidated rawtext for a revision
@@ -2109,7 +2102,7 b' class revlog(object):'
2109 2102
2110 2103 _df - an existing file handle to read from. (internal-only)
2111 2104 """
2112 return self._revisiondata(nodeorrev, _df, raw=True)[0]
2105 return self._revisiondata(nodeorrev, _df, raw=True)
2113 2106
2114 2107 def hash(self, text, p1, p2):
2115 2108 """Compute a node hash.
@@ -3109,7 +3102,7 b' class revlog(object):'
3109 3102 cachedelta = None
3110 3103 rawtext = None
3111 3104 if deltareuse == self.DELTAREUSEFULLADD:
3112 text = self._revisiondata(rev)[0]
3105 text = self._revisiondata(rev)
3113 3106 sidedata = self.sidedata(rev)
3114 3107
3115 3108 if sidedata_helpers is not None:
@@ -3138,7 +3131,7 b' class revlog(object):'
3138 3131
3139 3132 sidedata = None
3140 3133 if not cachedelta:
3141 rawtext = self._revisiondata(rev)[0]
3134 rawtext = self._revisiondata(rev)
3142 3135 sidedata = self.sidedata(rev)
3143 3136 if sidedata is None:
3144 3137 sidedata = self.sidedata(rev)
@@ -39,11 +39,12 b' def wrapaddrevision('
39 39
40 40
41 41 def wrap_revisiondata(orig, self, nodeorrev, *args, **kwargs):
42 text, sd = orig(self, nodeorrev, *args, **kwargs)
42 text = orig(self, nodeorrev, *args, **kwargs)
43 sd = self.sidedata(nodeorrev)
43 44 if getattr(self, 'sidedatanocheck', False):
44 return text, sd
45 return text
45 46 if self.hassidedata:
46 return text, sd
47 return text
47 48 if nodeorrev != nullrev and nodeorrev != self.nullid:
48 49 cat1 = sd.get(sidedata.SD_TEST1)
49 50 if cat1 is not None and len(text) != struct.unpack('>I', cat1)[0]:
@@ -52,7 +53,7 b' def wrap_revisiondata(orig, self, nodeor'
52 53 got = hashlib.sha256(text).digest()
53 54 if expected is not None and got != expected:
54 55 raise RuntimeError('sha256 mismatch')
55 return text, sd
56 return text
56 57
57 58
58 59 def wrapget_sidedata_helpers(orig, srcrepo, dstrepo):
General Comments 0
You need to be logged in to leave comments. Login now