Mercurial > hg
changeset 41818:f6eff9e4de80
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.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 27 Feb 2019 10:49:25 +0100 |
parents | 169c386cc9d8 |
children | 688fc33e105d |
files | mercurial/configitems.py mercurial/help/config.txt mercurial/localrepo.py tests/test-generaldelta.t tests/test-sparse-revlog.t |
diffstat | 5 files changed, 32 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/configitems.py Sat Mar 02 09:41:17 2019 +0900 +++ b/mercurial/configitems.py Wed Feb 27 10:49:25 2019 +0100 @@ -983,6 +983,9 @@ default=True, alias=[('format', 'aggressivemergedeltas')], ) +coreconfigitem('storage', 'revlog.reuse-external-delta-parent', + default=None, +) coreconfigitem('server', 'bookmarks-pushkey-compat', default=True, )
--- a/mercurial/help/config.txt Sat Mar 02 09:41:17 2019 +0900 +++ b/mercurial/help/config.txt Wed Feb 27 10:49:25 2019 +0100 @@ -1843,6 +1843,28 @@ 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`` ----------
--- a/mercurial/localrepo.py Sat Mar 02 09:41:17 2019 +0900 +++ b/mercurial/localrepo.py Wed Feb 27 10:49:25 2019 +0100 @@ -752,7 +752,11 @@ 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:
--- a/tests/test-generaldelta.t Sat Mar 02 09:41:17 2019 +0900 +++ b/tests/test-generaldelta.t Wed Feb 27 10:49:25 2019 +0100 @@ -339,7 +339,7 @@ 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
--- a/tests/test-sparse-revlog.t Sat Mar 02 09:41:17 2019 +0900 +++ b/tests/test-sparse-revlog.t Wed Feb 27 10:49:25 2019 +0100 @@ -40,8 +40,7 @@ > 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