##// END OF EJS Templates
bundle2: introduce `replycaps` part for on-demand reply...
Pierre-Yves David -
r21130:1ff06386 default
parent child Browse files
Show More
@@ -280,9 +280,6 b' def processbundle(repo, unbundler, trans'
280 """
280 """
281 op = bundleoperation(repo, transactiongetter)
281 op = bundleoperation(repo, transactiongetter)
282 # todo:
282 # todo:
283 # - only create reply bundle if requested.
284 op.reply = bundle20(op.ui)
285 # todo:
286 # - replace this is a init function soon.
283 # - replace this is a init function soon.
287 # - exception catching
284 # - exception catching
288 unbundler.params
285 unbundler.params
@@ -674,3 +671,11 b' def handlechangegroup(op, inpart):'
674 assert not h
671 assert not h
675 if heads != op.repo.heads():
672 if heads != op.repo.heads():
676 raise exchange.PushRaced()
673 raise exchange.PushRaced()
674
675 @parthandler('replycaps')
676 def handlereplycaps(op, inpart):
677 """Notify that a reply bundle should be created
678
679 Will convey bundle capability at some point too."""
680 if op.reply is None:
681 op.reply = bundle20(op.ui)
@@ -208,6 +208,7 b' def _pushbundle2(pushop):'
208 evolve in the future."""
208 evolve in the future."""
209 # Send known head to the server for race detection.
209 # Send known head to the server for race detection.
210 bundler = bundle2.bundle20(pushop.ui)
210 bundler = bundle2.bundle20(pushop.ui)
211 bundler.addpart(bundle2.bundlepart('replycaps'))
211 if not pushop.force:
212 if not pushop.force:
212 part = bundle2.bundlepart('CHECK:HEADS', data=iter(pushop.remoteheads))
213 part = bundle2.bundlepart('CHECK:HEADS', data=iter(pushop.remoteheads))
213 bundler.addpart(part)
214 bundler.addpart(part)
@@ -45,6 +45,7 b' Create an extension to test bundle2 API'
45 > [('', 'param', [], 'stream level parameter'),
45 > [('', 'param', [], 'stream level parameter'),
46 > ('', 'unknown', False, 'include an unknown mandatory part in the bundle'),
46 > ('', 'unknown', False, 'include an unknown mandatory part in the bundle'),
47 > ('', 'parts', False, 'include some arbitrary parts to the bundle'),
47 > ('', 'parts', False, 'include some arbitrary parts to the bundle'),
48 > ('', 'reply', False, 'produce a reply bundle'),
48 > ('r', 'rev', [], 'includes those changeset in the bundle'),],
49 > ('r', 'rev', [], 'includes those changeset in the bundle'),],
49 > '[OUTPUTFILE]')
50 > '[OUTPUTFILE]')
50 > def cmdbundle2(ui, repo, path=None, **opts):
51 > def cmdbundle2(ui, repo, path=None, **opts):
@@ -57,6 +58,9 b' Create an extension to test bundle2 API'
57 > except ValueError, exc:
58 > except ValueError, exc:
58 > raise util.Abort('%s' % exc)
59 > raise util.Abort('%s' % exc)
59 >
60 >
61 > if opts['reply']:
62 > bundler.addpart(bundle2.bundlepart('replycaps'))
63 >
60 > revs = opts['rev']
64 > revs = opts['rev']
61 > if 'rev' in opts:
65 > if 'rev' in opts:
62 > revs = scmutil.revrange(repo, opts['rev'])
66 > revs = scmutil.revrange(repo, opts['rev'])
@@ -493,19 +497,20 b' Unbundle with an unknown mandatory part'
493
497
494 unbundle with a reply
498 unbundle with a reply
495
499
496 $ hg unbundle2 ../reply.hg2 < ../parts.hg2
500 $ hg bundle2 --parts --reply ../parts-reply.hg2
501 $ hg unbundle2 ../reply.hg2 < ../parts-reply.hg2
497 The choir starts singing:
502 The choir starts singing:
498 Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko
503 Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko
499 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
504 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
500 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.
505 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.
501 received ping request (id 4)
506 received ping request (id 5)
502 0 unread bytes
507 0 unread bytes
503 3 total verses sung
508 3 total verses sung
504
509
505 The reply is a bundle
510 The reply is a bundle
506
511
507 $ cat ../reply.hg2
512 $ cat ../reply.hg2
508 HG20\x00\x00\x00\x1e test:pong\x00\x00\x00\x00\x01\x00\x0b\x01in-reply-to4\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
513 HG20\x00\x00\x00\x1e test:pong\x00\x00\x00\x00\x01\x00\x0b\x01in-reply-to5\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
509
514
510 The reply is valid
515 The reply is valid
511
516
@@ -629,7 +634,7 b' Support for changegroup'
629 \x87\xcd\xc9n\x8e\xaa\xb6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02H (esc)
634 \x87\xcd\xc9n\x8e\xaa\xb6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02H (esc)
630 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
635 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
631
636
632 $ hg unbundle2 ../rev-replay.hg2 < ../rev.hg2
637 $ hg unbundle2 < ../rev.hg2
633 adding changesets
638 adding changesets
634 adding manifests
639 adding manifests
635 adding file changes
640 adding file changes
@@ -637,8 +642,19 b' Support for changegroup'
637 0 unread bytes
642 0 unread bytes
638 addchangegroup return: 1
643 addchangegroup return: 1
639
644
640 $ cat ../rev-replay.hg2
645 with reply
641 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)
646
647 $ hg bundle2 --rev '8+7+5+4' --reply ../rev-rr.hg2
648 $ hg unbundle2 ../rev-reply.hg2 < ../rev-rr.hg2
649 adding changesets
650 adding manifests
651 adding file changes
652 added 0 changesets with 0 changes to 3 files
653 0 unread bytes
654 addchangegroup return: 1
655
656 $ cat ../rev-reply.hg2
657 HG20\x00\x00\x00/\x11reply:changegroup\x00\x00\x00\x00\x00\x02\x0b\x01\x06\x01in-reply-to1return1\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
642
658
643 Real world exchange
659 Real world exchange
644 =====================
660 =====================
General Comments 0
You need to be logged in to leave comments. Login now