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

login
register
mail settings
Submitter Pierre-Yves David
Date Oct. 7, 2015, 6:54 p.m.
Message ID <813eff15577c3e93f312.1444244078@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/10861/
State Accepted
Headers show

Comments

Pierre-Yves David - Oct. 7, 2015, 6:54 p.m.
# 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 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.
Augie Fackler - Oct. 8, 2015, 5:28 p.m.
On Wed, Oct 07, 2015 at 11:54:38AM -0700, Pierre-Yves David wrote:
> # 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 813eff15577c3e93f312d461d6b65556a2e7846a
> # Parent  b40e70b120ce89870fc0777c5f1794ff3cd18dd8
> bundle: use bundle2 if repository uses general delta

these are queued, thanks

>
> 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.
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

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.