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

login
register
mail settings
Submitter Pierre-Yves David
Date Sept. 29, 2015, 7:57 p.m.
Message ID <1cfd337ef697249576f5.1443556630@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/10689/
State Accepted
Headers show

Comments

Pierre-Yves David - Sept. 29, 2015, 7:57 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.
Matt Mackall - Sept. 29, 2015, 9:47 p.m.
On Tue, 2015-09-29 at 12:57 -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@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

Queued for default, thanks.

Patch

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 ..