Patchwork D3393: bundle: introduce per-engine compression level

login
register
mail settings
Submitter phabricator
Date April 17, 2018, 1:09 a.m.
Message ID <differential-rev-PHID-DREV-3qqe2erqamus23d7xb6l-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/31150/
State Superseded
Headers show

Comments

phabricator - April 17, 2018, 1:09 a.m.
joerg.sonnenberger created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3393

AFFECTED FILES
  mercurial/commands.py
  mercurial/configitems.py
  tests/test-bundle-type.t

CHANGE DETAILS




To: joerg.sonnenberger, #hg-reviewers
Cc: mercurial-devel
phabricator - April 17, 2018, 5:40 a.m.
indygreg added a comment.


  I'm -0 on this because it's yet more experimental code. Since this experimental option was added, the code for parsing bundle specs has been drastically improved. I would rather we declare a bundlespec parameter to define the compression level (e.g. ``;complevel=4``) and have the bundler consume that. The code touched in commands.py already has access to the parsed bundlespec.
  
  But if we don't want to do that so close to freeze, I'm fine adding yet more experimental config options.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3393

To: joerg.sonnenberger, #hg-reviewers
Cc: indygreg, mercurial-devel
phabricator - April 17, 2018, 2:54 p.m.
joerg.sonnenberger added a comment.


  I don't really disagree that the existing option naming is a bit stupid. There are useful points for including the compression level as part of the bundle spec, but I don't think that replaces the need for a config option for sane defaults.
  As I said on IRC, a consistent approach for the three places where compression is used would be useful:
  
  - standalone "hg bundle" operations
  - wire compression
  - reflog compression
  
  We currently don't allow tuning for the latter two, even though trade-offs between (write) performance and space make a lot of sense. As such, having a uniform mechanism for specifying the compression level sounds like a good idea.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3393

To: joerg.sonnenberger, #hg-reviewers
Cc: indygreg, mercurial-devel
phabricator - April 17, 2018, 8:45 p.m.
indygreg accepted this revision.
indygreg added a comment.
This revision is now accepted and ready to land.


  I'm going to queue this because it is a useful feature. But I would strongly prefer we formalize things early in the 3.7 cycle. This functionality is too important to only live behind experimental flags.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3393

To: joerg.sonnenberger, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel

Patch

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 @@ 
   $ 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
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -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,
 )
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1258,7 +1258,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