# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1443756703 25200
#      Thu Oct 01 20:31:43 2015 -0700
# Node ID 3e61b325e79af1c8b41c0e0425b17fa00be5084a
# Parent  1d1d0914cb761dcd1a41d1e163b2aec303d0e29b
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
@@ -3374,6 +3374,8 @@
 
     if version is None:
         version = '01'
+        if 'generaldelta' in repo.requirements:
+            version = '02'
     else:
         try:
             version = _bundleversionspecs[version]
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1223,7 +1223,7 @@
     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