Show More
@@ -117,6 +117,9 class pushoperation(object): | |||
|
117 | 117 | self.outbookmarks = [] |
|
118 | 118 | # transaction manager |
|
119 | 119 | self.trmanager = None |
|
120 | # map { pushkey partid -> callback handling failure} | |
|
121 | # used to handle exception from mandatory pushkey part failure | |
|
122 | self.pkfailcb = {} | |
|
120 | 123 | |
|
121 | 124 | @util.propertycache |
|
122 | 125 | def futureheads(self): |
@@ -623,6 +626,7 def _pushbundle2(pushop): | |||
|
623 | 626 | return |
|
624 | 627 | stream = util.chunkbuffer(bundler.getchunks()) |
|
625 | 628 | try: |
|
629 | try: | |
|
626 | 630 | reply = pushop.remote.unbundle(stream, ['force'], 'push') |
|
627 | 631 | except error.BundleValueError, exc: |
|
628 | 632 | raise util.Abort('missing support for %s' % exc) |
@@ -633,6 +637,11 def _pushbundle2(pushop): | |||
|
633 | 637 | op = bundle2.processbundle(pushop.repo, reply, trgetter) |
|
634 | 638 | except error.BundleValueError, exc: |
|
635 | 639 | raise util.Abort('missing support for %s' % exc) |
|
640 | except error.PushkeyFailed, exc: | |
|
641 | partid = int(exc.partid) | |
|
642 | if partid not in pushop.pkfailcb: | |
|
643 | raise | |
|
644 | pushop.pkfailcb[partid](pushop, exc) | |
|
636 | 645 | for rephand in replyhandlers: |
|
637 | 646 | rephand(op) |
|
638 | 647 |
@@ -724,6 +724,7 Check abort from mandatory pushkey | |||
|
724 | 724 | > from mercurial import exchange |
|
725 | 725 | > from mercurial import pushkey |
|
726 | 726 | > from mercurial import node |
|
727 | > from mercurial import error | |
|
727 | 728 | > @exchange.b2partsgenerator('failingpuskey') |
|
728 | 729 | > def addfailingpushey(pushop, bundler): |
|
729 | 730 | > enc = pushkey.encode |
@@ -732,6 +733,9 Check abort from mandatory pushkey | |||
|
732 | 733 | > part.addparam('key', enc(pushop.repo['cd010b8cd998'].hex())) |
|
733 | 734 | > part.addparam('old', enc(str(0))) # successful update |
|
734 | 735 | > part.addparam('new', enc(str(0))) |
|
736 | > def fail(pushop, exc): | |
|
737 | > raise error.Abort('Correct phase push failed (because hooks)') | |
|
738 | > pushop.pkfailcb[part.id] = fail | |
|
735 | 739 | > EOF |
|
736 | 740 | $ cat >> $HGRCPATH << EOF |
|
737 | 741 | > [hooks] |
@@ -759,7 +763,7 Check abort from mandatory pushkey | |||
|
759 | 763 | transaction abort! |
|
760 | 764 | Cleaning up the mess... |
|
761 | 765 | rollback completed |
|
762 | abort: failed to update value for "phases/cd010b8cd998f3981a5a8115f94f8da4ab506089" | |
|
766 | abort: Correct phase push failed (because hooks) | |
|
763 | 767 | [255] |
|
764 | 768 | $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6 |
|
765 | 769 | pushing to ssh://user@dummy/other |
@@ -796,6 +800,7 Check abort from mandatory pushkey | |||
|
796 | 800 | > from mercurial import exchange |
|
797 | 801 | > from mercurial import pushkey |
|
798 | 802 | > from mercurial import node |
|
803 | > from mercurial import error | |
|
799 | 804 | > @exchange.b2partsgenerator('failingpuskey') |
|
800 | 805 | > def addfailingpushey(pushop, bundler): |
|
801 | 806 | > enc = pushkey.encode |
@@ -804,6 +809,9 Check abort from mandatory pushkey | |||
|
804 | 809 | > part.addparam('key', enc(pushop.repo['cd010b8cd998'].hex())) |
|
805 | 810 | > part.addparam('old', enc(str(4))) # will fail |
|
806 | 811 | > part.addparam('new', enc(str(3))) |
|
812 | > def fail(pushop, exc): | |
|
813 | > raise error.Abort('Clown phase push failed') | |
|
814 | > pushop.pkfailcb[part.id] = fail | |
|
807 | 815 | > EOF |
|
808 | 816 | $ cat >> $HGRCPATH << EOF |
|
809 | 817 | > [hooks] |
@@ -826,7 +834,7 Check abort from mandatory pushkey | |||
|
826 | 834 | pushkey: lock state after "phases" |
|
827 | 835 | lock: free |
|
828 | 836 | wlock: free |
|
829 | abort: failed to update value for "phases/cd010b8cd998f3981a5a8115f94f8da4ab506089" | |
|
837 | abort: Clown phase push failed | |
|
830 | 838 | [255] |
|
831 | 839 | $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6 |
|
832 | 840 | pushing to ssh://user@dummy/other |
General Comments 0
You need to be logged in to leave comments.
Login now