##// END OF EJS Templates
bundle2: use reply part to return result of addchangegroup...
Pierre-Yves David -
r20998:93a3c5b5 default
parent child Browse files
Show More
@@ -558,7 +558,7 b' class part(object):'
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
@@ -570,10 +570,21 b' def handlechangegroup(op, part):'
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 if op.reply is not None:
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)]))
578
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']))
579
590
@@ -626,7 +626,7 b' Support for changegroup'
626 \x87\xcd\xc9n\x8e\xaa\xb6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02H (esc)
626 \x87\xcd\xc9n\x8e\xaa\xb6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02H (esc)
627 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
627 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
628
628
629 $ hg unbundle2 < ../rev.hg2
629 $ hg unbundle2 ../rev-replay.hg2 < ../rev.hg2
630 adding changesets
630 adding changesets
631 adding manifests
631 adding manifests
632 adding file changes
632 adding file changes
@@ -634,6 +634,9 b' Support for changegroup'
634 0 unread bytes
634 0 unread bytes
635 addchangegroup return: 1
635 addchangegroup return: 1
636
636
637 $ cat ../rev-replay.hg2
638 HG20\x00\x00\x00/\x11reply:changegroup\x00\x00\x00\x00\x00\x02\x0b\x01\x06\x01in-reply-to0return1\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
639
637 Real world exchange
640 Real world exchange
638 =====================
641 =====================
639
642
General Comments 0
You need to be logged in to leave comments. Login now