Show More
@@ -307,7 +307,21 b' def processbundle(repo, unbundler, trans' | |||||
307 | # risk catching KeyErrors from anything other than the |
|
307 | # risk catching KeyErrors from anything other than the | |
308 | # parthandlermapping lookup (any KeyError raised by handler() |
|
308 | # parthandlermapping lookup (any KeyError raised by handler() | |
309 | # itself represents a defect of a different variety). |
|
309 | # itself represents a defect of a different variety). | |
310 | handler(op, part) |
|
310 | output = None | |
|
311 | if op.reply is not None: | |||
|
312 | op.ui.pushbuffer() | |||
|
313 | output = '' | |||
|
314 | try: | |||
|
315 | handler(op, part) | |||
|
316 | finally: | |||
|
317 | if output is not None: | |||
|
318 | output = op.ui.popbuffer() | |||
|
319 | if output: | |||
|
320 | outpart = bundlepart('output', | |||
|
321 | advisoryparams=[('in-reply-to', | |||
|
322 | str(part.id))], | |||
|
323 | data=output) | |||
|
324 | op.reply.addpart(outpart) | |||
311 | part.read() |
|
325 | part.read() | |
312 | except Exception: |
|
326 | except Exception: | |
313 | if part is not None: |
|
327 | if part is not None: | |
@@ -672,6 +686,12 b' def handlechangegroup(op, inpart):' | |||||
672 | if heads != op.repo.heads(): |
|
686 | if heads != op.repo.heads(): | |
673 | raise exchange.PushRaced() |
|
687 | raise exchange.PushRaced() | |
674 |
|
688 | |||
|
689 | @parthandler('output') | |||
|
690 | def handleoutput(op, inpart): | |||
|
691 | """forward output captured on the server to the client""" | |||
|
692 | for line in inpart.read().splitlines(): | |||
|
693 | op.ui.write(('remote: %s\n' % line)) | |||
|
694 | ||||
675 | @parthandler('replycaps') |
|
695 | @parthandler('replycaps') | |
676 | def handlereplycaps(op, inpart): |
|
696 | def handlereplycaps(op, inpart): | |
677 | """Notify that a reply bundle should be created |
|
697 | """Notify that a reply bundle should be created | |
@@ -679,3 +699,4 b' def handlereplycaps(op, inpart):' | |||||
679 | Will convey bundle capability at some point too.""" |
|
699 | Will convey bundle capability at some point too.""" | |
680 | if op.reply is None: |
|
700 | if op.reply is None: | |
681 | op.reply = bundle20(op.ui) |
|
701 | op.reply = bundle20(op.ui) | |
|
702 |
@@ -499,28 +499,46 b' unbundle with a reply' | |||||
499 |
|
499 | |||
500 | $ hg bundle2 --parts --reply ../parts-reply.hg2 |
|
500 | $ hg bundle2 --parts --reply ../parts-reply.hg2 | |
501 | $ hg unbundle2 ../reply.hg2 < ../parts-reply.hg2 |
|
501 | $ hg unbundle2 ../reply.hg2 < ../parts-reply.hg2 | |
502 | The choir starts singing: |
|
|||
503 | Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko |
|
|||
504 | Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko |
|
|||
505 | Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. |
|
|||
506 | received ping request (id 5) |
|
|||
507 |
|
|
502 | 0 unread bytes | |
508 | 3 total verses sung |
|
503 | 3 total verses sung | |
509 |
|
504 | |||
510 | The reply is a bundle |
|
505 | The reply is a bundle | |
511 |
|
506 | |||
512 | $ cat ../reply.hg2 |
|
507 | $ cat ../reply.hg2 | |
513 |
HG20\x00\x00\x00\x1 |
|
508 | HG20\x00\x00\x00\x1b\x06output\x00\x00\x00\x00\x00\x01\x0b\x01in-reply-to3\x00\x00\x00\xd9The choir starts singing: (esc) | |
|
509 | Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko | |||
|
510 | Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko | |||
|
511 | Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. | |||
|
512 | \x00\x00\x00\x00\x00\x1e test:pong\x00\x00\x00\x01\x01\x00\x0b\x01in-reply-to5\x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x02\x00\x01\x0b\x01in-reply-to5\x00\x00\x00\x1dreceived ping request (id 5) (esc) | |||
|
513 | \x00\x00\x00\x00\x00\x00 (no-eol) (esc) | |||
514 |
|
514 | |||
515 | The reply is valid |
|
515 | The reply is valid | |
516 |
|
516 | |||
517 | $ hg statbundle2 < ../reply.hg2 |
|
517 | $ hg statbundle2 < ../reply.hg2 | |
518 | options count: 0 |
|
518 | options count: 0 | |
|
519 | :output: | |||
|
520 | mandatory: 0 | |||
|
521 | advisory: 1 | |||
|
522 | payload: 217 bytes | |||
519 | :test:pong: |
|
523 | :test:pong: | |
520 | mandatory: 1 |
|
524 | mandatory: 1 | |
521 | advisory: 0 |
|
525 | advisory: 0 | |
522 | payload: 0 bytes |
|
526 | payload: 0 bytes | |
523 | parts count: 1 |
|
527 | :output: | |
|
528 | mandatory: 0 | |||
|
529 | advisory: 1 | |||
|
530 | payload: 29 bytes | |||
|
531 | parts count: 3 | |||
|
532 | ||||
|
533 | Unbundle the reply to get the output: | |||
|
534 | ||||
|
535 | $ hg unbundle2 < ../reply.hg2 | |||
|
536 | remote: The choir starts singing: | |||
|
537 | remote: Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko | |||
|
538 | remote: Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko | |||
|
539 | remote: Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. | |||
|
540 | remote: received ping request (id 5) | |||
|
541 | 0 unread bytes | |||
524 |
|
542 | |||
525 | Support for changegroup |
|
543 | Support for changegroup | |
526 | =================================== |
|
544 | =================================== | |
@@ -646,15 +664,15 b' with reply' | |||||
646 |
|
664 | |||
647 | $ hg bundle2 --rev '8+7+5+4' --reply ../rev-rr.hg2 |
|
665 | $ hg bundle2 --rev '8+7+5+4' --reply ../rev-rr.hg2 | |
648 | $ hg unbundle2 ../rev-reply.hg2 < ../rev-rr.hg2 |
|
666 | $ 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 |
|
667 | 0 unread bytes | |
654 | addchangegroup return: 1 |
|
668 | addchangegroup return: 1 | |
655 |
|
669 | |||
656 | $ cat ../rev-reply.hg2 |
|
670 | $ 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 |
|
671 | HG20\x00\x00\x00/\x11reply:changegroup\x00\x00\x00\x00\x00\x02\x0b\x01\x06\x01in-reply-to1return1\x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to1\x00\x00\x00dadding changesets (esc) | |
|
672 | adding manifests | |||
|
673 | adding file changes | |||
|
674 | added 0 changesets with 0 changes to 3 files | |||
|
675 | \x00\x00\x00\x00\x00\x00 (no-eol) (esc) | |||
658 |
|
676 | |||
659 | Real world exchange |
|
677 | Real world exchange | |
660 | ===================== |
|
678 | ===================== | |
@@ -699,10 +717,10 b' push' | |||||
699 | $ hg -R main push other --rev eea13746799a |
|
717 | $ hg -R main push other --rev eea13746799a | |
700 | pushing to other |
|
718 | pushing to other | |
701 | searching for changes |
|
719 | searching for changes | |
702 | adding changesets |
|
720 | remote: adding changesets | |
703 | adding manifests |
|
721 | remote: adding manifests | |
704 | adding file changes |
|
722 | remote: adding file changes | |
705 | added 1 changesets with 0 changes to 0 files (-1 heads) |
|
723 | remote: added 1 changesets with 0 changes to 0 files (-1 heads) | |
706 |
|
724 | |||
707 | pull over ssh |
|
725 | pull over ssh | |
708 |
|
726 | |||
@@ -748,6 +766,10 b' push over http' | |||||
748 | $ hg -R main push http://localhost:$HGPORT2/ -r 32af7686d403 |
|
766 | $ hg -R main push http://localhost:$HGPORT2/ -r 32af7686d403 | |
749 | pushing to http://localhost:$HGPORT2/ |
|
767 | pushing to http://localhost:$HGPORT2/ | |
750 | searching for changes |
|
768 | searching for changes | |
|
769 | remote: adding changesets | |||
|
770 | remote: adding manifests | |||
|
771 | remote: adding file changes | |||
|
772 | remote: added 1 changesets with 1 changes to 1 files | |||
751 | $ cat other-error.log |
|
773 | $ cat other-error.log | |
752 |
|
774 | |||
753 | Check final content. |
|
775 | Check final content. |
General Comments 0
You need to be logged in to leave comments.
Login now