[PATCH V2] unbundle: test and fix for clean abort on unknown bundle2 feature

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Sep 29 19:57:10 UTC 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1443142341 25200
#      Thu Sep 24 17:52:21 2015 -0700
# Node ID 1cfd337ef697249576f5bbac782c6299a6efc195
# Parent  19d946cf2a1bf921e78de18f52cfabcc3401035f
unbundle: test and fix for clean abort on unknown bundle2 feature

This introduce a test for the feature and fix the exception name that is
different on default.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6386,11 +6386,11 @@ def unbundle(ui, repo, fname1, *fnames, 
             if isinstance(gen, bundle2.unbundle20):
                 tr = repo.transaction('unbundle')
                 try:
                     op = bundle2.processbundle(repo, gen, lambda: tr)
                     tr.close()
-                except error.UnsupportedPartError as exc:
+                except error.BundleUnknownFeatureError as exc:
                     raise util.Abort(_('%s: unknown bundle feature, %s')
                                      % (fname, exc),
                                      hint=_("see https://mercurial.selenic.com/"
                                             "wiki/BundleFeature for more "
                                             "information"))
diff --git a/tests/test-bundle2-format.t b/tests/test-bundle2-format.t
--- a/tests/test-bundle2-format.t
+++ b/tests/test-bundle2-format.t
@@ -1217,7 +1217,11 @@ unknown compression while unbundling
 
   $ hg bundle2 --param Compression=FooBarUnknown --rev '8+7+5+4' ../rev.hg2.bz
   $ cat ../rev.hg2.bz | hg statbundle2
   abort: unknown parameters: Stream Parameter - Compression='FooBarUnknown'
   [255]
+  $ hg unbundle ../rev.hg2.bz
+  abort: ../rev.hg2.bz: unknown bundle feature, Stream Parameter - Compression='FooBarUnknown'
+  (see https://mercurial.selenic.com/wiki/BundleFeature for more information)
+  [255]
 
   $ cd ..


More information about the Mercurial-devel mailing list