[PATCH 2 of 6] bundle: check changegroup version earlier

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sat May 6 04:04:56 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1493927162 -7200
#      Thu May 04 21:46:02 2017 +0200
# Node ID 711809dcb24b495e26c91cb482b3741af7d33458
# Parent  f2da8236b1566e14cce6e83169000b9376429433
# EXP-Topic bundle.cleanup
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 711809dcb24b
bundle: check changegroup version earlier

We can check if we know how to bundle this changegroup version before actually
starting to generate the changegroup.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1372,8 +1372,6 @@ def bundle(ui, repo, fname, dest=None, *
         scmutil.nochangesfound(ui, repo, not base and outgoing.excluded)
         return 1
 
-    cg = changegroup.getchangegroup(repo, 'bundle', outgoing, version=cgversion)
-
     if cgversion == '01': #bundle1
         if bcompression is None:
             bcompression = 'UN'
@@ -1385,6 +1383,8 @@ def bundle(ui, repo, fname, dest=None, *
         raise error.ProgrammingError(
             'bundle: unexpected changegroup version %s' % cgversion)
 
+    cg = changegroup.getchangegroup(repo, 'bundle', outgoing, version=cgversion)
+
     # TODO compression options should be derived from bundlespec parsing.
     # This is a temporary hack to allow adjusting bundle compression
     # level without a) formalizing the bundlespec changes to declare it


More information about the Mercurial-devel mailing list