changeset 21606:e55888447958

bundle2: update part creators to ``addparam`` when relevant In some cases, the use of ``addparam`` makes code much clearer.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 23 May 2014 16:46:30 -0700
parents f9dabfceb259
children 054fa5176fa7
files mercurial/bundle2.py
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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')