bundle2: use the new ``part.params`` dictionary
authorPierre-Yves David <pierre-yves.david@fb.com>
Mon, 26 May 2014 18:45:43 -0700
changeset 21611 71b7b3f79a3c
parent 21610 d6056805f8f4
child 21612 f221eb0531d9
bundle2: use the new ``part.params`` dictionary We use the new ``part.params`` dictionary to access the value of parameters instead of creating one from the part's attributes.
mercurial/bundle2.py
--- a/mercurial/bundle2.py	Fri May 23 17:26:57 2014 -0700
+++ b/mercurial/bundle2.py	Mon May 26 18:45:43 2014 -0700
@@ -794,9 +794,9 @@
 
 @parthandler('b2x:reply:changegroup')
 def handlechangegroup(op, inpart):
-    p = dict(inpart.advisoryparams)
-    ret = int(p['return'])
-    op.records.add('changegroup', {'return': ret}, int(p['in-reply-to']))
+    ret = int(inpart.params['return'])
+    replyto = int(inpart.params['in-reply-to'])
+    op.records.add('changegroup', {'return': ret}, replyto)
 
 @parthandler('b2x:check:heads')
 def handlechangegroup(op, inpart):
@@ -832,18 +832,14 @@
 @parthandler('b2x:error:abort')
 def handlereplycaps(op, inpart):
     """Used to transmit abort error over the wire"""
-    manargs = dict(inpart.mandatoryparams)
-    advargs = dict(inpart.advisoryparams)
-    raise util.Abort(manargs['message'], hint=advargs.get('hint'))
+    raise util.Abort(inpart.params['message'], hint=inpart.params.get('hint'))
 
 @parthandler('b2x:error:unknownpart')
 def handlereplycaps(op, inpart):
     """Used to transmit unknown part error over the wire"""
-    manargs = dict(inpart.mandatoryparams)
-    raise UnknownPartError(manargs['parttype'])
+    raise UnknownPartError(inpart.params['parttype'])
 
 @parthandler('b2x:error:pushraced')
 def handlereplycaps(op, inpart):
     """Used to transmit push race error over the wire"""
-    manargs = dict(inpart.mandatoryparams)
-    raise error.ResponseError(_('push failed:'), manargs['message'])
+    raise error.ResponseError(_('push failed:'), inpart.params['message'])