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