changeset 51059:47d43efda8b7

revlog: remove legacy usage of `_withsparseread` All core code is now getting the setting from the DeltaConfig object.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 10 Oct 2023 11:24:37 +0200
parents 8bdb2478c4bc
children f71f07a679b4
files contrib/perf.py mercurial/debugcommands.py mercurial/revlog.py
diffstat 3 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Tue Oct 10 11:16:07 2023 +0200
+++ b/contrib/perf.py	Tue Oct 10 11:24:37 2023 +0200
@@ -3983,7 +3983,13 @@
 
     size = r.length(rev)
     chain = r._deltachain(rev)[0]
-    if not getattr(r, '_withsparseread', False):
+
+    with_sparse_read = False
+    if hasattr(r, 'data_config'):
+        with_sparse_read = r.data_config.with_sparse_read
+    elif hasattr(r, '_withsparseread'):
+        with_sparse_read = r._withsparseread
+    if with_sparse_read:
         slicedchain = (chain,)
     else:
         slicedchain = tuple(slicechunk(r, chain, targetsize=size))
@@ -4000,7 +4006,7 @@
         (lambda: doread(chain), b'read'),
     ]
 
-    if getattr(r, '_withsparseread', False):
+    if with_sparse_read:
         slicing = (lambda: doslice(r, chain, size), b'slice-sparse-chain')
         benches.append(slicing)
 
--- a/mercurial/debugcommands.py	Tue Oct 10 11:16:07 2023 +0200
+++ b/mercurial/debugcommands.py	Tue Oct 10 11:24:37 2023 +0200
@@ -806,7 +806,7 @@
     start = r.start
     length = r.length
     generaldelta = r.delta_config.general_delta
-    withsparseread = getattr(r, '_withsparseread', False)
+    withsparseread = r.data_config.with_sparse_read
 
     # security to avoid crash on corrupted revlogs
     total_revs = len(index)
--- a/mercurial/revlog.py	Tue Oct 10 11:16:07 2023 +0200
+++ b/mercurial/revlog.py	Tue Oct 10 11:24:37 2023 +0200
@@ -2021,7 +2021,7 @@
         l = []
         ladd = l.append
 
-        if not self._withsparseread:
+        if not self.data_config.with_sparse_read:
             slicedchunks = (revs,)
         else:
             slicedchunks = deltautil.slicechunk(