revlog: remove legacy usage of `hassidedata`
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 10 Oct 2023 11:29:19 +0200
changeset 51061 7c2dc75cdc0f
parent 51060 f71f07a679b4
child 51062 8c614fa16330
revlog: remove legacy usage of `hassidedata` All core code is now getting the setting from the FeatureConfig object.
mercurial/revlog.py
tests/testlib/ext-sidedata.py
--- a/mercurial/revlog.py	Tue Oct 10 11:27:39 2023 +0200
+++ b/mercurial/revlog.py	Tue Oct 10 11:29:19 2023 +0200
@@ -1156,7 +1156,7 @@
         return self.index[rev][1]
 
     def sidedata_length(self, rev):
-        if not self.hassidedata:
+        if not self.feature_config.has_side_data:
             return 0
         return self.index[rev][9]
 
@@ -2565,7 +2565,7 @@
 
         if sidedata is None:
             sidedata = {}
-        elif sidedata and not self.hassidedata:
+        elif sidedata and not self.feature_config.has_side_data:
             raise error.ProgrammingError(
                 _(b"trying to add sidedata to a revlog who don't support them")
             )
@@ -2824,7 +2824,7 @@
             compression_mode, deltainfo = r
 
         sidedata_compression_mode = COMP_MODE_INLINE
-        if sidedata and self.hassidedata:
+        if sidedata and self.feature_config.has_side_data:
             sidedata_compression_mode = COMP_MODE_PLAIN
             serialized_sidedata = sidedatautil.serialize_sidedata(sidedata)
             sidedata_offset = self._docket.sidedata_end
@@ -3640,7 +3640,7 @@
         return d
 
     def rewrite_sidedata(self, transaction, helpers, startrev, endrev):
-        if not self.hassidedata:
+        if not self.feature_config.has_side_data:
             return
         # revlog formats with sidedata support does not support inline
         assert not self._inline
@@ -3669,7 +3669,7 @@
                 )
 
                 sidedata_compression_mode = COMP_MODE_INLINE
-                if serialized_sidedata and self.hassidedata:
+                if serialized_sidedata and self.feature_config.has_side_data:
                     sidedata_compression_mode = COMP_MODE_PLAIN
                     h, comp_sidedata = self.compress(serialized_sidedata)
                     if (
--- a/tests/testlib/ext-sidedata.py	Tue Oct 10 11:27:39 2023 +0200
+++ b/tests/testlib/ext-sidedata.py	Tue Oct 10 11:29:19 2023 +0200
@@ -42,7 +42,7 @@
     sd = self.sidedata(nodeorrev)
     if getattr(self, 'sidedatanocheck', False):
         return text
-    if self.hassidedata:
+    if self.feature_config.has_side_data:
         return text
     if nodeorrev != nullrev and nodeorrev != self.nullid:
         cat1 = sd.get(sidedata.SD_TEST1)