[PATCH 3 of 3] bundle: use bundle2 if repository uses general delta

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Oct 7 13:54:38 CDT 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1443756703 25200
#      Thu Oct 01 20:31:43 2015 -0700
# Node ID 813eff15577c3e93f312d461d6b65556a2e7846a
# Parent  b40e70b120ce89870fc0777c5f1794ff3cd18dd8
bundle: use bundle2 if repository uses general delta

As bundle1 does not support generaldelta, this would mean recomputing delta at
bundle time. This is similar to what we do for strip and shelve and was tracked
as issue4865.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -3372,10 +3372,12 @@ def parsebundletype(repo, spec):
         except KeyError:
             raise util.Abort(_('unknown bundle type specified with --type'))
 
     if version is None:
         version = '01'
+        if 'generaldelta' in repo.requirements:
+            version = '02'
     else:
         try:
             version = _bundleversionspecs[version]
         except KeyError:
             raise util.Abort(_('unknown bundle type specified with --type'))
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1221,11 +1221,11 @@ def bundle(ui, repo, fname, dest=None, *
 
     You can change bundle format with the -t/--type option. You can
     specify a compression, a bundle version or both using a dash
     (comp-version). The available compression methods are: none, bzip2,
     and gzip (by default, bundles are compressed using bzip2). The
-    available format are: v1, v2 (default to v1).
+    available format are: v1, v2 (default to most suitable).
 
     The bundle file can then be transferred using conventional means
     and applied to another repository with the unbundle or pull
     command. This is useful when direct push and pull are not
     available or when exporting an entire repository is undesirable.


More information about the Mercurial-devel mailing list