814 abort: pretxnclose.error hook exited with status 1 |
813 abort: pretxnclose.error hook exited with status 1 |
815 [255] |
814 [255] |
816 $ hg recover |
815 $ hg recover |
817 no interrupted transaction available |
816 no interrupted transaction available |
818 [1] |
817 [1] |
|
818 $ cd .. |
|
819 |
|
820 Hook from untrusted hgrc are reported as failure |
|
821 ================================================ |
|
822 |
|
823 $ cat << EOF > $TESTTMP/untrusted.py |
|
824 > from mercurial import scmutil, util |
|
825 > def uisetup(ui): |
|
826 > class untrustedui(ui.__class__): |
|
827 > def _trusted(self, fp, f): |
|
828 > if util.normpath(fp.name).endswith('untrusted/.hg/hgrc'): |
|
829 > return False |
|
830 > return super(untrustedui, self)._trusted(fp, f) |
|
831 > ui.__class__ = untrustedui |
|
832 > EOF |
|
833 $ cat << EOF >> $HGRCPATH |
|
834 > [extensions] |
|
835 > untrusted=$TESTTMP/untrusted.py |
|
836 > EOF |
|
837 $ hg init untrusted |
|
838 $ cd untrusted |
|
839 |
|
840 Non-blocking hook |
|
841 ----------------- |
|
842 |
|
843 $ cat << EOF >> .hg/hgrc |
|
844 > [hooks] |
|
845 > txnclose.testing=echo txnclose hook called |
|
846 > EOF |
|
847 $ touch a && hg commit -Aqm a |
|
848 warning: untrusted hook txnclose not executed |
|
849 $ hg log |
|
850 changeset: 0:3903775176ed |
|
851 tag: tip |
|
852 user: test |
|
853 date: Thu Jan 01 00:00:00 1970 +0000 |
|
854 summary: a |
|
855 |
|
856 |
|
857 Non-blocking hook |
|
858 ----------------- |
|
859 |
|
860 $ cat << EOF >> .hg/hgrc |
|
861 > [hooks] |
|
862 > pretxnclose.testing=echo pre-txnclose hook called |
|
863 > EOF |
|
864 $ touch b && hg commit -Aqm a |
|
865 transaction abort! |
|
866 rollback completed |
|
867 abort: untrusted hook pretxnclose not executed |
|
868 (see 'hg help config.trusted') |
|
869 [255] |
|
870 $ hg log |
|
871 changeset: 0:3903775176ed |
|
872 tag: tip |
|
873 user: test |
|
874 date: Thu Jan 01 00:00:00 1970 +0000 |
|
875 summary: a |
|
876 |