[PATCH 1 of 8] bundle: allow bundle command to use changegroup3 in tests

Jun Wu quark at fb.com
Fri Apr 7 02:08:09 UTC 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1491523318 25200
#      Thu Apr 06 17:01:58 2017 -0700
# Node ID 3d62d68ed4245359b5ae5b6b6c1959a15ffa84e9
# Parent  45761ef1bc935b1fab74adccf2541ef854b1c2eb
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 3d62d68ed424
bundle: allow bundle command to use changegroup3 in tests

Since bundle2 writes changegroup version, we can just reuse the bundle2
format for changegroup3.

This won't enable the bundle command to write changegroup3 in the wild,
since exchange.parsebundlespec only returns changegroup2. It unlocks tests
to override exchange.parsebundlespec and get "hg bundle" write changegroup3.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1377,7 +1377,9 @@ def bundle(ui, repo, fname, dest=None, *
         bversion = 'HG10' + bcompression
         bcompression = None
+    elif cgversion in ('02', '03'):
+        bversion = 'HG20'
     else:
-        assert cgversion == '02'
-        bversion = 'HG20'
+        raise error.ProgrammingError(
+            'bundle: unexpected changegroup version %s' % cgversion)
 
     # TODO compression options should be derived from bundlespec parsing.


More information about the Mercurial-devel mailing list