bundle2: allow to specify unsupported value on error
A client may support an argument but not some of its values (eg: coming
"compression" parameters). We allow this case to be carried in the
exception.
--- a/mercurial/error.py Wed Sep 23 11:44:52 2015 -0700
+++ b/mercurial/error.py Wed Sep 23 11:55:27 2015 -0700
@@ -142,15 +142,26 @@
"""error raised when bundle2 cannot be processed"""
class BundleUnknownFeatureError(BundleValueError):
- def __init__(self, parttype=None, params=()):
+ def __init__(self, parttype=None, params=(), values=()):
self.parttype = parttype
self.params = params
+ self.values = values
if self.parttype is None:
msg = 'Stream Parameter'
else:
msg = parttype
- if self.params:
- msg = '%s - %s' % (msg, ', '.join(self.params))
+ entries = self.params
+ if self.params and self.values:
+ assert len(self.params) == len(self.values)
+ entries = []
+ for idx, par in enumerate(self.params):
+ val = self.values[idx]
+ if val is None:
+ entries.append(val)
+ else:
+ entries.append("%s=%r" % (par, val))
+ if entries:
+ msg = '%s - %s' % (msg, ', '.join(entries))
ValueError.__init__(self, msg)
class ReadOnlyPartError(RuntimeError):