changeset 51083:5645524c6b62

revlog: also migrates `revlog.upperboundcomp` to ConfigClass This was planned but overlooked when doing the rest of the migration.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 13 Oct 2023 16:11:04 +0200
parents 808f1e38cd1d
children 9d5efaefc544
files mercurial/revlog.py mercurial/revlogutils/deltas.py
diffstat 2 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Fri Oct 13 16:03:26 2023 +0200
+++ b/mercurial/revlog.py	Fri Oct 13 16:11:04 2023 +0200
@@ -425,7 +425,6 @@
         that test, debug, or performance measurement code might not set this to
         accurate value.
         """
-        self.upperboundcomp = upperboundcomp
 
         self.radix = radix
 
@@ -460,6 +459,7 @@
             self.delta_config = self.opener.options[b'delta-config'].copy()
         else:
             self.delta_config = DeltaConfig()
+        self.delta_config.upper_bound_comp = upperboundcomp
 
         # 3-tuple of (node, rev, text) for a raw revision.
         self._revisioncache = None
@@ -574,6 +574,16 @@
         return self.feature_config.compression_engine
 
     @property
+    def upperboundcomp(self):
+        """temporary compatibility proxy"""
+        util.nouideprecwarn(
+            b"use revlog.delta_config.upper_bound_comp",
+            b"6.6",
+            stacklevel=2,
+        )
+        return self.delta_config.upper_bound_comp
+
+    @property
     def _compengineopts(self):
         """temporary compatibility proxy"""
         util.nouideprecwarn(
--- a/mercurial/revlogutils/deltas.py	Fri Oct 13 16:03:26 2023 +0200
+++ b/mercurial/revlogutils/deltas.py	Fri Oct 13 16:11:04 2023 +0200
@@ -784,8 +784,8 @@
             if deltas_limit < chainsize:
                 tested.add(rev)
                 continue
-            if sparse and revlog.upperboundcomp is not None:
-                maxcomp = revlog.upperboundcomp
+            if sparse and revlog.delta_config.upper_bound_comp is not None:
+                maxcomp = revlog.delta_config.upper_bound_comp
                 basenotsnap = (p1, p2, nullrev)
                 if rev not in basenotsnap and revlog.issnapshot(rev):
                     snapshotdepth = revlog.snapshotdepth(rev)
@@ -1186,8 +1186,10 @@
             msg %= len(delta)
             self._write_debug(msg)
         # snapshotdept need to be neither None nor 0 level snapshot
-        if revlog.upperboundcomp is not None and snapshotdepth:
-            lowestrealisticdeltalen = len(delta) // revlog.upperboundcomp
+        if revlog.delta_config.upper_bound_comp is not None and snapshotdepth:
+            lowestrealisticdeltalen = (
+                len(delta) // revlog.delta_config.upper_bound_comp
+            )
             snapshotlimit = revinfo.textlen >> snapshotdepth
             if self._debug_search:
                 msg = b"DBG-DELTAS-SEARCH:     projected-lower-size=%d\n"