43 > |
43 > |
44 > @command('bundle2', |
44 > @command('bundle2', |
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): |
51 > """write a bundle2 container on standard ouput""" |
52 > """write a bundle2 container on standard ouput""" |
52 > bundler = bundle2.bundle20(ui) |
53 > bundler = bundle2.bundle20(ui) |
54 > p = p.split('=', 1) |
55 > p = p.split('=', 1) |
55 > try: |
56 > try: |
56 > bundler.addparam(*p) |
57 > bundler.addparam(*p) |
57 > except ValueError, exc: |
58 > except ValueError, exc: |
58 > raise util.Abort('%s' % exc) |
59 > raise util.Abort('%s' % exc) |
|
60 > |
|
61 > if opts['reply']: |
|
62 > bundler.addpart(bundle2.bundlepart('replycaps')) |
59 > |
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']) |
63 > if revs: |
67 > if revs: |
491 abort: missing support for 'test:unknown' |
495 abort: missing support for 'test:unknown' |
492 [255] |
496 [255] |
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 |
512 $ hg statbundle2 < ../reply.hg2 |
517 $ hg statbundle2 < ../reply.hg2 |
513 options count: 0 |
518 options count: 0 |
627 \x0cI\xd4\xa9\xc5\x01|\xf0pC\xf5NX\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02E (esc) |
632 \x0cI\xd4\xa9\xc5\x01|\xf0pC\xf5NX\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02E (esc) |
628 \x00\x00\x00\x00\x00\x00\x00\x05H\x00\x00\x00b\x85\x00\x18\x9et\xa9\xe0G^\x82 \x93\xbc}\xb0\xd61\xae\xb0\xb4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xdeB\x19n\xbe\xe4.\xf2\x84\xb6x (esc) |
633 \x00\x00\x00\x00\x00\x00\x00\x05H\x00\x00\x00b\x85\x00\x18\x9et\xa9\xe0G^\x82 \x93\xbc}\xb0\xd61\xae\xb0\xb4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xdeB\x19n\xbe\xe4.\xf2\x84\xb6x (esc) |
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 |
636 added 0 changesets with 0 changes to 3 files |
641 added 0 changesets with 0 changes to 3 files |
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 ===================== |
645 |
661 |
646 |
662 |