changeset 37769:6a7ff5816c5f

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
author Joerg Sonnenberger <joerg@bec.de>
date Tue, 17 Apr 2018 03:07:01 +0200
parents 5527aa808dea
children 31750413f8d7
files mercurial/commands.py mercurial/configitems.py tests/test-bundle-type.t
diffstat 3 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Apr 17 02:41:25 2018 +0200
+++ b/mercurial/commands.py	Tue Apr 17 03:07:01 2018 +0200
@@ -1260,7 +1260,10 @@
     # 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
 
--- a/mercurial/configitems.py	Tue Apr 17 02:41:25 2018 +0200
+++ b/mercurial/configitems.py	Tue Apr 17 03:07:01 2018 +0200
@@ -440,6 +440,18 @@
 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,
 )
--- a/tests/test-bundle-type.t	Tue Apr 17 02:41:25 2018 +0200
+++ b/tests/test-bundle-type.t	Tue Apr 17 03:07:01 2018 +0200
@@ -154,6 +154,11 @@
   $ 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