# HG changeset patch # User Pierre-Yves David <pierre-yves.da...@octobus.net> # Date 1551267618 -3600 # Wed Feb 27 12:40:18 2019 +0100 # Node ID d1df36a5e877119ca96134b0ee2e886c32f40c38 # Parent ed7aebbee814840433cf40ce02aecde83d6129c1 # EXP-Topic delta-control # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r d1df36a5e877 storage: introduce a `revlog.reuse-external-delta` config
This option goes a bit further and provides a way to get the same behavior as the `re-delta-all` optimisation from `hg debugupgraderepo`. The effect of the option is a bit hard to test as we do not have multiple diff algorithm at hand. However, we at least make sure the code path run. diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -983,6 +983,9 @@ coreconfigitem('storage', 'revlog.optimi default=True, alias=[('format', 'aggressivemergedeltas')], ) +coreconfigitem('storage', 'revlog.reuse-external-delta', + default=True, +) coreconfigitem('storage', 'revlog.reuse-external-delta-parent', default=None, ) diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt --- a/mercurial/help/config.txt +++ b/mercurial/help/config.txt @@ -1865,6 +1865,22 @@ category impact performance and reposito considered. Even when disabled, the existing delta from the source will be reused if the same delta parent is selected. +``revlog.reuse-external-delta`` + Control the reuse of delta from external source. + (typically: apply bundle from `hg pull` or `hg push`). + + New revisions are usually provided as a delta against another revision. By + default, Mercurial will not recompute the same delta again , trusting + externally provided deltas. There have been rare cases of small adjustement + to the diffing algorithm in the past. So in some rare case, recomputing + delta provided by ancient clients can provides better results. Disabling + this option means going through a full delta recomputation for all incoming + revisions. It means a large increase in CPU usage and will slow operations + down. + + This option is enabled by default. When disabled, it also disable the + related ``storage.revlog.reuse-external-delta-parent`` option. + ``server`` ---------- diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -753,10 +753,14 @@ def resolverevlogstorevfsoptions(ui, req options[b'deltabothparents'] = deltabothparents - lazydeltabase = ui.configbool(b'storage', - b'revlog.reuse-external-delta-parent') + lazydelta = ui.configbool(b'storage', b'revlog.reuse-external-delta') + lazydeltabase = False + if lazydelta: + lazydeltabase = ui.configbool(b'storage', + b'revlog.reuse-external-delta-parent') if lazydeltabase is None: lazydeltabase = not scmutil.gddeltaconfig(ui) + options[b'lazydelta'] = lazydelta options[b'lazydeltabase'] = lazydeltabase chainspan = ui.configbytes(b'experimental', b'maxdeltachainspan') diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -410,7 +410,10 @@ class revlog(object): self._maxchainlen = opts['maxchainlen'] if 'deltabothparents' in opts: self._deltabothparents = opts['deltabothparents'] - self._lazydeltabase = bool(opts.get('lazydeltabase', False)) + self._lazydelta = bool(opts.get('lazydelta', True)) + self._lazydeltabase = False + if self._lazydelta: + self._lazydeltabase = bool(opts.get('lazydeltabase', False)) if 'compengine' in opts: self._compengine = opts['compengine'] if 'maxdeltachainspan' in opts: diff --git a/mercurial/revlogutils/deltas.py b/mercurial/revlogutils/deltas.py --- a/mercurial/revlogutils/deltas.py +++ b/mercurial/revlogutils/deltas.py @@ -916,7 +916,7 @@ class deltacomputer(object): and currentbase != base and self.revlog.length(currentbase) == 0): currentbase = self.revlog.deltaparent(currentbase) - if currentbase == base: + if self.revlog._lazydelta and currentbase == base: delta = revinfo.cachedelta[1] if delta is None: delta = self._builddeltadiff(base, revinfo, fh) diff --git a/tests/test-sparse-revlog.t b/tests/test-sparse-revlog.t --- a/tests/test-sparse-revlog.t +++ b/tests/test-sparse-revlog.t @@ -40,7 +40,7 @@ repeatedly while some of it changes rare > maxchainlen = 15 > [storage] > revlog.optimize-delta-parent-choice = yes - > revlog.reuse-external-delta-parent = no + > revlog.reuse-external-delta = no > EOF $ hg init sparse-repo $ cd sparse-repo _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel