Patchwork [2,of,6] bundle: check changegroup version earlier

login
register
mail settings
Submitter Pierre-Yves David
Date May 6, 2017, 8:04 a.m.
Message ID <711809dcb24b495e26c9.1494057896@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/20481/
State Accepted
Headers show

Comments

Pierre-Yves David - May 6, 2017, 8:04 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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