405 |
405 |
406 Parts contains the actual applicative payload.""" |
406 Parts contains the actual applicative payload.""" |
407 assert part.id is None |
407 assert part.id is None |
408 part.id = len(self._parts) # very cheap counter |
408 part.id = len(self._parts) # very cheap counter |
409 self._parts.append(part) |
409 self._parts.append(part) |
|
410 |
|
411 def newpart(self, typeid, *args, **kwargs): |
|
412 """create a new part for the containers""" |
|
413 part = bundlepart(typeid, *args, **kwargs) |
|
414 return part |
410 |
415 |
411 # methods used to generate the bundle2 stream |
416 # methods used to generate the bundle2 stream |
412 def getchunks(self): |
417 def getchunks(self): |
413 self.ui.debug('start emission of %s stream\n' % _magicstring) |
418 self.ui.debug('start emission of %s stream\n' % _magicstring) |
414 yield _magicstring |
419 yield _magicstring |
705 ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2') |
710 ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2') |
706 op.records.add('changegroup', {'return': ret}) |
711 op.records.add('changegroup', {'return': ret}) |
707 if op.reply is not None: |
712 if op.reply is not None: |
708 # This is definitly not the final form of this |
713 # This is definitly not the final form of this |
709 # return. But one need to start somewhere. |
714 # return. But one need to start somewhere. |
710 part = bundlepart('b2x:reply:changegroup', (), |
715 part = op.reply.newpart('b2x:reply:changegroup', (), |
711 [('in-reply-to', str(inpart.id)), |
716 [('in-reply-to', str(inpart.id)), |
712 ('return', '%i' % ret)]) |
717 ('return', '%i' % ret)]) |
713 op.reply.addpart(part) |
718 op.reply.addpart(part) |
714 assert not inpart.read() |
719 assert not inpart.read() |
715 |
720 |
716 @parthandler('b2x:reply:changegroup') |
721 @parthandler('b2x:reply:changegroup') |
717 def handlechangegroup(op, inpart): |
722 def handlechangegroup(op, inpart): |