[PATCH 3 of 6] bundle2: allow to specify unsupported value on error
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Wed Sep 23 20:21:22 CDT 2015
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1443034527 25200
# Wed Sep 23 11:55:27 2015 -0700
# Node ID dfdcae90e506369cba7889e61fb5667793dcf371
# Parent 2d9c6c878f6eddddf71ddd629295f556e77a5e8d
bundle2: allow to specify unsupported value on error
A client may supports an argument but not some of its values (eg: coming
"compression" parameters). We allow this case to be carried in the
exception.
diff --git a/mercurial/error.py b/mercurial/error.py
--- a/mercurial/error.py
+++ b/mercurial/error.py
@@ -136,19 +136,30 @@ class PushRaced(RuntimeError):
# bundle2 related errors
class BundleValueError(ValueError):
"""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):
"""error raised when code tries to alter a part being generated"""
pass
More information about the Mercurial-devel
mailing list