# HG changeset patch # User Pierre-Yves David # Date 2014-05-23 23:46:30 # Node ID e55888447958098e82a477f320522a122131b8d3 # Parent f9dabfceb259d643abe650256a4eee1cd5df78ec bundle2: update part creators to ``addparam`` when relevant In some cases, the use of ``addparam`` makes code much clearer. diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -325,10 +325,8 @@ def processbundle(repo, unbundler, trans 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 @@ def handlechangegroup(op, inpart): 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')