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