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