[Updated] [+ ] D10341: sidedata: gate sidedata functionality to revlogv2 in more places

Alphare (Raphaël Gomès) phabricator at mercurial-scm.org
Mon Apr 19 10:11:36 UTC 2021


Alphare updated this revision to Diff 27030.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D10341?vs=26750&id=27030

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D10341/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D10341

AFFECTED FILES
  mercurial/changegroup.py
  mercurial/localrepo.py
  mercurial/revlog.py

CHANGE DETAILS

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



To: Alphare, indygreg, #hg-reviewers, marmoute
Cc: marmoute, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210419/f4ea38bd/attachment-0002.html>


More information about the Mercurial-patches mailing list