diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -294,7 +294,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(), diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -3364,6 +3364,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): diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -2373,7 +2373,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: