Mercurial > hg-stable
changeset 47092:5554aacd783f
sidedata: gate sidedata functionality to revlogv2 in more places
Since revlogv1 is not capable of storing sidedata, we prevent sidedata
mechanisms around the revlog layer from doing anything. We however keep the
ones that allow a revlogv1 repo to generate sidedata on-the-fly on a push, the
pull case simply does not add the sidedata to the revlog.
Differential Revision: https://phab.mercurial-scm.org/D10341
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Thu, 08 Apr 2021 16:39:39 +0200 |
parents | b409cdc6a139 |
children | 08e26ef4ad35 |
files | mercurial/changegroup.py mercurial/localrepo.py mercurial/revlog.py |
diffstat | 3 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/changegroup.py Tue Mar 30 17:03:02 2021 +0200 +++ b/mercurial/changegroup.py Thu Apr 08 16:39:39 2021 +0200 @@ -293,7 +293,12 @@ # Only useful if we're adding sidedata categories. If both peers have # the same categories, then we simply don't do anything. - if self.version == b'04' and srctype == b'pull': + adding_sidedata = ( + requirements.REVLOGV2_REQUIREMENT in repo.requirements + and self.version == b'04' + and srctype == b'pull' + ) + if adding_sidedata: sidedata_helpers = get_sidedata_helpers( repo, sidedata_categories or set(),
--- a/mercurial/localrepo.py Tue Mar 30 17:03:02 2021 +0200 +++ b/mercurial/localrepo.py Thu Apr 08 16:39:39 2021 +0200 @@ -3365,6 +3365,9 @@ return self.pathto(fp.name[len(self.root) + 1 :]) def register_wanted_sidedata(self, category): + if requirementsmod.REVLOGV2_REQUIREMENT not in self.requirements: + # Only revlogv2 repos can want sidedata. + return self._wanted_sidedata.add(pycompat.bytestr(category)) def register_sidedata_computer(self, kind, category, keys, computer):
--- a/mercurial/revlog.py Tue Mar 30 17:03:02 2021 +0200 +++ b/mercurial/revlog.py Thu Apr 08 16:39:39 2021 +0200 @@ -2246,7 +2246,7 @@ deltainfo = deltacomputer.finddeltainfo(revinfo, fh) - if sidedata: + if sidedata and self.version & 0xFFFF == REVLOGV2: serialized_sidedata = sidedatautil.serialize_sidedata(sidedata) sidedata_offset = offset + deltainfo.deltalen else: