# HG changeset patch # User Joerg Sonnenberger # Date 2018-04-17 01:07:01 # Node ID 6a7ff5816c5f182e535466972ba080c0c0118f63 # Parent 5527aa808dea5bc7b53d6f1f3afd450af6bbaf10 bundle: introduce per-engine compression level If experimental.bundlecomplevel.$engine is set, prefer it over the generic experimental.bundlecomplevel. Given that compression levels have widely different meanings across engines, this allows much saner configuration. Differential Revision: https://phab.mercurial-scm.org/D3393 diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1260,7 +1260,10 @@ def bundle(ui, repo, fname, dest=None, * # level without a) formalizing the bundlespec changes to declare it # b) introducing a command flag. compopts = {} - complevel = ui.configint('experimental', 'bundlecomplevel') + complevel = ui.configint('experimental', + 'bundlecomplevel.' + bundlespec.compression) + if complevel is None: + complevel = ui.configint('experimental', 'bundlecomplevel') if complevel is not None: compopts['level'] = complevel diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -440,6 +440,18 @@ coreconfigitem('experimental', 'bundle2l coreconfigitem('experimental', 'bundlecomplevel', default=None, ) +coreconfigitem('experimental', 'bundlecomplevel.bzip2', + default=None, +) +coreconfigitem('experimental', 'bundlecomplevel.gzip', + default=None, +) +coreconfigitem('experimental', 'bundlecomplevel.none', + default=None, +) +coreconfigitem('experimental', 'bundlecomplevel.zstd', + default=None, +) coreconfigitem('experimental', 'changegroup3', default=False, ) diff --git a/tests/test-bundle-type.t b/tests/test-bundle-type.t --- a/tests/test-bundle-type.t +++ b/tests/test-bundle-type.t @@ -154,6 +154,11 @@ Compression level can be adjusted for bu $ f --size gzip-v2-level1.hg gzip-v2-level1.hg: size=475 + $ hg --config experimental.bundlecomplevel.gzip=1 --config experimental.bundlelevel=9 bundle -a -t gzip-v2 gzip-v2-level1.hg + 1 changesets found + $ f --size gzip-v2-level1.hg + gzip-v2-level1.hg: size=475 + $ cd .. #if zstd