comparison tests/test-phases.t @ 35494:f6d17075608f

phase: add a dedicated pretxnclose-phase hook This new hook mirror the newly introduced 'txnclose-phase' but can abort the transaction.
author Boris Feld <boris.feld@octobus.net>
date Sun, 08 Oct 2017 17:23:18 +0200
parents cdf833d7de98
children 1644623ab096
comparison
equal deleted inserted replaced
35493:cdf833d7de98 35494:f6d17075608f
730 6: draft 730 6: draft
731 transaction abort! 731 transaction abort!
732 rollback completed 732 rollback completed
733 abort: pretxnclose hook exited with status 1 733 abort: pretxnclose hook exited with status 1
734 [255] 734 [255]
735
736 Check that pretxnclose-phase hook can control phase movement
737
738 $ hg phase --force b3325c91a4d9 --secret
739 test-debug-phase: move rev 3: 0 -> 2
740 test-debug-phase: move rev 4: 0 -> 2
741 test-debug-phase: move rev 5: 1 -> 2
742 test-debug-phase: move rev 7: 0 -> 2
743 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: 0 -> 2
744 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: 0 -> 2
745 test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: 1 -> 2
746 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: 0 -> 2
747 $ hg log -G -T phases
748 @ changeset: 7:17a481b3bccb
749 |\ tag: tip
750 | | phase: secret
751 | | parent: 6:cf9fe039dfd6
752 | | parent: 4:a603bfb5a83e
753 | | user: test
754 | | date: Thu Jan 01 00:00:00 1970 +0000
755 | | summary: merge B' and E
756 | |
757 | o changeset: 6:cf9fe039dfd6
758 | | phase: public
759 | | parent: 1:27547f69f254
760 | | user: test
761 | | date: Thu Jan 01 00:00:00 1970 +0000
762 | | summary: B'
763 | |
764 o | changeset: 4:a603bfb5a83e
765 | | phase: secret
766 | | user: test
767 | | date: Thu Jan 01 00:00:00 1970 +0000
768 | | summary: E
769 | |
770 o | changeset: 3:b3325c91a4d9
771 | | phase: secret
772 | | user: test
773 | | date: Thu Jan 01 00:00:00 1970 +0000
774 | | summary: D
775 | |
776 o | changeset: 2:f838bfaca5c7
777 |/ phase: public
778 | user: test
779 | date: Thu Jan 01 00:00:00 1970 +0000
780 | summary: C
781 |
782 o changeset: 1:27547f69f254
783 | phase: public
784 | user: test
785 | date: Thu Jan 01 00:00:00 1970 +0000
786 | summary: B
787 |
788 o changeset: 0:4a2df7238c3b
789 phase: public
790 user: test
791 date: Thu Jan 01 00:00:00 1970 +0000
792 summary: A
793
794
795 Install a hook that prevent b3325c91a4d9 to become public
796
797 $ cat >> .hg/hgrc << EOF
798 > [hooks]
799 > pretxnclose-phase.nopublish_D = (echo \$HG_NODE| grep -v b3325c91a4d9>/dev/null) || [ 0 -lt \$HG_PHASE ]
800 > EOF
801
802 Try various actions. only the draft move should succeed
803
804 $ hg phase --public b3325c91a4d9
805 transaction abort!
806 rollback completed
807 abort: pretxnclose-phase.nopublish_D hook exited with status 1
808 [255]
809 $ hg phase --public a603bfb5a83e
810 transaction abort!
811 rollback completed
812 abort: pretxnclose-phase.nopublish_D hook exited with status 1
813 [255]
814 $ hg phase --draft 17a481b3bccb
815 test-debug-phase: move rev 3: 2 -> 1
816 test-debug-phase: move rev 4: 2 -> 1
817 test-debug-phase: move rev 7: 2 -> 1
818 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: 2 -> 1
819 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: 2 -> 1
820 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: 2 -> 1
821 $ hg phase --public 17a481b3bccb
822 transaction abort!
823 rollback completed
824 abort: pretxnclose-phase.nopublish_D hook exited with status 1
825 [255]