bundle2: raise BundleValueError error for stream level unsupported params
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 28 May 2014 15:37:47 -0700
changeset 21628 7c5a85619dca
parent 21627 3e8bcc90f07c
child 21629 664c49420d48
bundle2: raise BundleValueError error for stream level unsupported params This ensures both consistency and smooth propagation over the wire.
mercurial/bundle2.py
tests/test-bundle2.t
--- a/mercurial/bundle2.py	Wed May 28 16:46:58 2014 -0700
+++ b/mercurial/bundle2.py	Wed May 28 15:37:47 2014 -0700
@@ -523,7 +523,7 @@
         if name[0].islower():
             self.ui.debug("ignoring unknown parameter %r\n" % name)
         else:
-            raise KeyError(name)
+            raise error.BundleValueError(params=(name,))
 
 
     def iterparts(self):
--- a/tests/test-bundle2.t	Wed May 28 16:46:58 2014 -0700
+++ b/tests/test-bundle2.t	Wed May 28 15:37:47 2014 -0700
@@ -166,7 +166,7 @@
   >     unbundler = bundle2.unbundle20(ui, sys.stdin)
   >     try:
   >         params = unbundler.params
-  >     except KeyError, exc:
+  >     except error.BundleValueError, exc:
   >        raise util.Abort('unknown parameters: %s' % exc)
   >     ui.write('options count: %i\n' % len(params))
   >     for key in sorted(params):
@@ -304,7 +304,7 @@
 ---------------------------------------------------
 
   $ hg bundle2 --param 'Gravity' | hg statbundle2
-  abort: unknown parameters: 'Gravity'
+  abort: unknown parameters: Stream Parameter - Gravity
   [255]
 
 Test debug output