[PATCH 2 of 6] bundle2: rename error exception class for unsupported feature
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Wed Sep 23 20:21:21 CDT 2015
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1443033892 25200
# Wed Sep 23 11:44:52 2015 -0700
# Node ID 2d9c6c878f6eddddf71ddd629295f556e77a5e8d
# Parent 0e8207361f5a0eb27fd92288c34c5bb3d1d3eb53
bundle2: rename error exception class for unsupported feature
The original name explicitly mention "Part", however it is also used outside of
parts related feature. We rename from 'UnsupportedPartError' to
'BundleUnknownFeatureError' to fix this.
diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -374,21 +374,21 @@ def _processpart(op, part):
try:
try:
handler = parthandlermapping.get(part.type)
if handler is None:
status = 'unsupported-type'
- raise error.UnsupportedPartError(parttype=part.type)
+ raise error.BundleUnknownFeatureError(parttype=part.type)
indebug(op.ui, 'found a handler for part %r' % part.type)
unknownparams = part.mandatorykeys - handler.params
if unknownparams:
unknownparams = list(unknownparams)
unknownparams.sort()
status = 'unsupported-params (%s)' % unknownparams
- raise error.UnsupportedPartError(parttype=part.type,
- params=unknownparams)
+ raise error.BundleUnknownFeatureError(parttype=part.type,
+ params=unknownparams)
status = 'supported'
- except error.UnsupportedPartError as exc:
+ except error.BundleUnknownFeatureError as exc:
if part.mandatory: # mandatory parts
raise
indebug(op.ui, 'ignoring unsupported advisory part %s' % exc)
return # skip to part processing
finally:
@@ -664,11 +664,11 @@ class unbundle20(unpackermixin):
# Some logic will be later added here to try to process the option for
# a dict of known parameter.
if name[0].islower():
indebug(self.ui, "ignoring unknown parameter %r" % name)
else:
- raise error.UnsupportedPartError(params=(name,))
+ raise error.BundleUnknownFeatureError(params=(name,))
def iterparts(self):
"""yield all parts contained in the stream"""
# make sure param have been loaded
@@ -1327,11 +1327,11 @@ def handleerrorunsupportedcontent(op, in
kwargs['parttype'] = parttype
params = inpart.params.get('params')
if params is not None:
kwargs['params'] = params.split('\0')
- raise error.UnsupportedPartError(**kwargs)
+ raise error.BundleUnknownFeatureError(**kwargs)
@parthandler('error:pushraced', ('message',))
def handleerrorpushraced(op, inpart):
"""Used to transmit push race error over the wire"""
raise error.ResponseError(_('push failed:'), inpart.params['message'])
diff --git a/mercurial/error.py b/mercurial/error.py
--- a/mercurial/error.py
+++ b/mercurial/error.py
@@ -135,11 +135,11 @@ class PushRaced(RuntimeError):
# bundle2 related errors
class BundleValueError(ValueError):
"""error raised when bundle2 cannot be processed"""
-class UnsupportedPartError(BundleValueError):
+class BundleUnknownFeatureError(BundleValueError):
def __init__(self, parttype=None, params=()):
self.parttype = parttype
self.params = params
if self.parttype is None:
msg = 'Stream Parameter'
More information about the Mercurial-devel
mailing list