# HG changeset patch # User Pierre-Yves David <pierre-yves.da...@octobus.net> # Date 1551260965 -3600 # Wed Feb 27 10:49:25 2019 +0100 # Node ID ed7aebbee814840433cf40ce02aecde83d6129c1 # Parent 090a41251f093e8b8b97046deeef59f1d060d4e4 # EXP-Topic delta-control # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r ed7aebbee814 storage: introduce a `revlog.reuse-external-delta-parent` config
As pointed in c59987ab96b4, we had no simple way to get a client to not blindly reuse the delta parent from a bundle. Instead one had to rely on a side effect of the deprecated `format.generaldelta` configuration. We introduce an explicit `revlog.reuse-external-delta-parent` configuration option (default to True) to control this behavior. If the option is not set, `format.generaldelta` still control this behavior. To test the new option, we convert a couple of place where `generaldelta` have been used for its side effects. 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-parent', + default=None, +) coreconfigitem('server', 'bookmarks-pushkey-compat', default=True, ) diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt --- a/mercurial/help/config.txt +++ b/mercurial/help/config.txt @@ -1843,6 +1843,28 @@ category impact performance and reposito Turning this option off can result in large increase of repository size for repository with many merges. +``revlog.reuse-external-delta-parent`` + Control the order in which delta parents are considered when adding new + revisions from an external source. + (typically: apply bundle from `hg pull` or `hg push`). + + New revisions are usually provided as a delta against other revisions. By + default, Mercurial will try to reuse this delta first, therefore using the + same "delta parent" as the source. Directly using delta's from the source + reduces CPU usage and usually speeds up operation. However, in some case, + the source might have sub-optimal delta bases and forcing their reevaluation + is useful. For example, pushes from an old client could have sub-optimal + delta's parent that the server want to optimize. (lack of general delta, bad + parents, choice, lack of sparse-revlog, etc). + + This option is enabled by default. Turning it off will ensure bad delta + parent choices from older client do not propagate to this repository, at + the cost of a small increase in CPU consumption. + + Note: this option only control the order in which delta parents are + considered. Even when disabled, the existing delta from the source will be + reused if the same delta parent is selected. + ``server`` ---------- diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -752,7 +752,12 @@ def resolverevlogstorevfsoptions(ui, req b'revlog.optimize-delta-parent-choice') options[b'deltabothparents'] = deltabothparents - options[b'lazydeltabase'] = not scmutil.gddeltaconfig(ui) + + lazydeltabase = ui.configbool(b'storage', + b'revlog.reuse-external-delta-parent') + if lazydeltabase is None: + lazydeltabase = not scmutil.gddeltaconfig(ui) + options[b'lazydeltabase'] = lazydeltabase chainspan = ui.configbytes(b'experimental', b'maxdeltachainspan') if 0 <= chainspan: diff --git a/tests/test-generaldelta.t b/tests/test-generaldelta.t --- a/tests/test-generaldelta.t +++ b/tests/test-generaldelta.t @@ -339,7 +339,7 @@ test maxdeltachainspan 52 5 1 -1 base 369 640 369 0.57656 369 0 0.00000 53 6 1 -1 base 0 0 0 0.00000 0 0 0.00000 54 7 1 -1 base 369 640 369 0.57656 369 0 0.00000 - $ hg clone --pull source-repo --config experimental.maxdeltachainspan=0 noconst-chain --config format.generaldelta=yes + $ hg clone --pull source-repo --config experimental.maxdeltachainspan=0 noconst-chain --config format.usegeneraldelta=yes --config storage.revlog.reuse-external-delta-parent=no requesting all changes adding changesets adding manifests 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,8 +40,7 @@ repeatedly while some of it changes rare > maxchainlen = 15 > [storage] > revlog.optimize-delta-parent-choice = yes - > [format] - > generaldelta = yes + > revlog.reuse-external-delta-parent = 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