Mercurial > hg-stable
changeset 47150:84b176ad2860
revlog: replace REVLOGV2 check related to sidedata with `hassidedata` checks
This is more flexible and semantically more correct. The associated revlog's
attribute exist since 827cb4fe62a3, so well we start linking sidedata to
revlogv2.
Differential Revision: https://phab.mercurial-scm.org/D10562
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 03 May 2021 12:19:09 +0200 |
parents | 1352cc14cce2 |
children | c261899fb282 |
files | mercurial/revlog.py tests/testlib/ext-sidedata.py |
diffstat | 2 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Mon May 03 12:19:05 2021 +0200 +++ b/mercurial/revlog.py Mon May 03 12:19:09 2021 +0200 @@ -715,7 +715,7 @@ return self.index[rev][1] def sidedata_length(self, rev): - if self.version & 0xFFFF != REVLOGV2: + if not self.hassidedata: return 0 return self.index[rev][9] @@ -1771,7 +1771,7 @@ # revision or might need to be processed to retrieve the revision. rev, rawtext, validated = self._rawtext(node, rev, _df=_df) - if self.version & 0xFFFF == REVLOGV2: + if self.hassidedata: if rev is None: rev = self.rev(node) sidedata = self._sidedata(rev) @@ -2246,7 +2246,7 @@ deltainfo = deltacomputer.finddeltainfo(revinfo, fh) - if sidedata and self.version & 0xFFFF == REVLOGV2: + if sidedata and self.hassidedata: serialized_sidedata = sidedatautil.serialize_sidedata(sidedata) sidedata_offset = offset + deltainfo.deltalen else: @@ -3072,7 +3072,7 @@ return d def rewrite_sidedata(self, helpers, startrev, endrev): - if self.version & 0xFFFF != REVLOGV2: + if not self.hassidedata: return # inline are not yet supported because they suffer from an issue when # rewriting them (since it's not an append-only operation).
--- a/tests/testlib/ext-sidedata.py Mon May 03 12:19:05 2021 +0200 +++ b/tests/testlib/ext-sidedata.py Mon May 03 12:19:09 2021 +0200 @@ -42,7 +42,7 @@ text, sd = orig(self, nodeorrev, *args, **kwargs) if getattr(self, 'sidedatanocheck', False): return text, sd - if self.version & 0xFFFF != 2: + if self.hassidedata: return text, sd if nodeorrev != nullrev and nodeorrev != self.nullid: cat1 = sd.get(sidedata.SD_TEST1)