bundle2: update part creators to ``addparam`` when relevant
In some cases, the use of ``addparam`` makes code much clearer.
--- a/mercurial/bundle2.py Thu May 22 11:38:40 2014 -0700
+++ b/mercurial/bundle2.py Fri May 23 16:46:30 2014 -0700
@@ -325,10 +325,8 @@
if output is not None:
output = op.ui.popbuffer()
if output:
- op.reply.newpart('b2x:output',
- advisoryparams=[('in-reply-to',
- str(part.id))],
- data=output)
+ outpart = op.reply.newpart('b2x:output', data=output)
+ outpart.addparam('in-reply-to', str(part.id), mandatory=False)
part.read()
except Exception, exc:
if part is not None:
@@ -769,9 +767,9 @@
if op.reply is not None:
# This is definitly not the final form of this
# return. But one need to start somewhere.
- op.reply.newpart('b2x:reply:changegroup', (),
- [('in-reply-to', str(inpart.id)),
- ('return', '%i' % ret)])
+ part = op.reply.newpart('b2x:reply:changegroup')
+ part.addparam('in-reply-to', str(inpart.id), mandatory=False)
+ part.addparam('return', '%i' % ret, mandatory=False)
assert not inpart.read()
@parthandler('b2x:reply:changegroup')