556 yield self.data |
556 yield self.data |
557 # end of payload |
557 # end of payload |
558 yield _pack(_fpayloadsize, 0) |
558 yield _pack(_fpayloadsize, 0) |
559 |
559 |
560 @parthandler('changegroup') |
560 @parthandler('changegroup') |
561 def handlechangegroup(op, part): |
561 def handlechangegroup(op, inpart): |
562 """apply a changegroup part on the repo |
562 """apply a changegroup part on the repo |
563 |
563 |
564 This is a very early implementation that will massive rework before being |
564 This is a very early implementation that will massive rework before being |
565 inflicted to any end-user. |
565 inflicted to any end-user. |
566 """ |
566 """ |
568 # |
568 # |
569 # The addchangegroup function will get a transaction object by itself, but |
569 # The addchangegroup function will get a transaction object by itself, but |
570 # we need to make sure we trigger the creation of a transaction object used |
570 # we need to make sure we trigger the creation of a transaction object used |
571 # for the whole processing scope. |
571 # for the whole processing scope. |
572 op.gettransaction() |
572 op.gettransaction() |
573 data = StringIO.StringIO(part.data) |
573 data = StringIO.StringIO(inpart.data) |
574 data.seek(0) |
574 data.seek(0) |
575 cg = changegroup.readbundle(data, 'bundle2part') |
575 cg = changegroup.readbundle(data, 'bundle2part') |
576 ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2') |
576 ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2') |
577 op.records.add('changegroup', {'return': ret}) |
577 op.records.add('changegroup', {'return': ret}) |
578 |
578 if op.reply is not None: |
579 |
579 # This is definitly not the final form of this |
|
580 # return. But one need to start somewhere. |
|
581 op.reply.addpart(part('reply:changegroup', (), |
|
582 [('in-reply-to', str(inpart.id)), |
|
583 ('return', '%i' % ret)])) |
|
584 |
|
585 @parthandler('reply:changegroup') |
|
586 def handlechangegroup(op, inpart): |
|
587 p = dict(inpart.advisoryparams) |
|
588 ret = int(p['return']) |
|
589 op.records.add('changegroup', {'return': ret}, int(p['in-reply-to'])) |
|
590 |