##// END OF EJS Templates
bundle2: have ``newpart`` automatically add the part to the bundle...
Pierre-Yves David -
r21599:57cd844d default
parent child Browse files
Show More
@@ -381,7 +381,7 def encodecaps(caps):
381 class bundle20(object):
381 class bundle20(object):
382 """represent an outgoing bundle2 container
382 """represent an outgoing bundle2 container
383
383
384 Use the `addparam` method to add stream level parameter. and `addpart` to
384 Use the `addparam` method to add stream level parameter. and `newpart` to
385 populate it. Then call `getchunks` to retrieve all the binary chunks of
385 populate it. Then call `getchunks` to retrieve all the binary chunks of
386 data that compose the bundle2 container."""
386 data that compose the bundle2 container."""
387
387
@@ -411,6 +411,7 class bundle20(object):
411 def newpart(self, typeid, *args, **kwargs):
411 def newpart(self, typeid, *args, **kwargs):
412 """create a new part for the containers"""
412 """create a new part for the containers"""
413 part = bundlepart(typeid, *args, **kwargs)
413 part = bundlepart(typeid, *args, **kwargs)
414 self.addpart(part)
414 return part
415 return part
415
416
416 # methods used to generate the bundle2 stream
417 # methods used to generate the bundle2 stream
@@ -712,10 +713,9 def handlechangegroup(op, inpart):
712 if op.reply is not None:
713 if op.reply is not None:
713 # This is definitly not the final form of this
714 # This is definitly not the final form of this
714 # return. But one need to start somewhere.
715 # return. But one need to start somewhere.
715 part = op.reply.newpart('b2x:reply:changegroup', (),
716 op.reply.newpart('b2x:reply:changegroup', (),
716 [('in-reply-to', str(inpart.id)),
717 [('in-reply-to', str(inpart.id)),
717 ('return', '%i' % ret)])
718 ('return', '%i' % ret)])
718 op.reply.addpart(part)
719 assert not inpart.read()
719 assert not inpart.read()
720
720
721 @parthandler('b2x:reply:changegroup')
721 @parthandler('b2x:reply:changegroup')
General Comments 0
You need to be logged in to leave comments. Login now