# HG changeset patch # User Pierre-Yves David # Date 2023-10-10 09:24:37 # Node ID 47d43efda8b7f17deb66284669d3be1dafea8656 # Parent 8bdb2478c4bcd1808555ed43be68778dee46a4f5 revlog: remove legacy usage of `_withsparseread` All core code is now getting the setting from the DeltaConfig object. diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -3983,7 +3983,13 @@ def perfrevlogrevision(ui, repo, file_, 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 @@ def perfrevlogrevision(ui, repo, file_, (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) diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -806,7 +806,7 @@ def debugdeltachain(ui, repo, file_=None 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) diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -2021,7 +2021,7 @@ class revlog: l = [] ladd = l.append - if not self._withsparseread: + if not self.data_config.with_sparse_read: slicedchunks = (revs,) else: slicedchunks = deltautil.slicechunk(