mercurial/bundle2.py
changeset 21598 1b0dbb91de5b
parent 21597 1daad9dcdba2
child 21599 57cd844d7a5b
--- a/mercurial/bundle2.py	Thu May 22 10:48:37 2014 -0700
+++ b/mercurial/bundle2.py	Fri May 23 15:45:46 2014 -0700
@@ -408,6 +408,11 @@
         part.id = len(self._parts) # very cheap counter
         self._parts.append(part)
 
+    def newpart(self, typeid, *args, **kwargs):
+        """create a new part for the containers"""
+        part = bundlepart(typeid, *args, **kwargs)
+        return part
+
     # methods used to generate the bundle2 stream
     def getchunks(self):
         self.ui.debug('start emission of %s stream\n' % _magicstring)
@@ -707,9 +712,9 @@
     if op.reply is not None:
         # This is definitly not the final form of this
         # return. But one need to start somewhere.
-        part = bundlepart('b2x:reply:changegroup', (),
-                           [('in-reply-to', str(inpart.id)),
-                            ('return', '%i' % ret)])
+        part = op.reply.newpart('b2x:reply:changegroup', (),
+                                [('in-reply-to', str(inpart.id)),
+                                ('return', '%i' % ret)])
         op.reply.addpart(part)
     assert not inpart.read()