Show More
@@ -1,12 +1,19 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
|
3 | cat > abortcommit.py <<EOF | |||
|
4 | from mercurial import util | |||
|
5 | ||||
|
6 | def hook(**args): | |||
|
7 | raise util.Abort("no commits allowed") | |||
|
8 | ||||
|
9 | def reposetup(ui, repo): | |||
|
10 | repo.ui.setconfig("hooks", "pretxncommit.nocommits", hook) | |||
|
11 | EOF | |||
|
12 | abspath=`pwd`/abortcommit.py | |||
|
13 | ||||
3 | echo "[extensions]" >> $HGRCPATH |
|
14 | echo "[extensions]" >> $HGRCPATH | |
4 | echo "mq=" >> $HGRCPATH |
|
15 | echo "mq=" >> $HGRCPATH | |
5 | cat > $HGTMP/false <<EOF |
|
16 | echo "abortcommit = $abspath" >> $HGRCPATH | |
6 | #!/bin/sh |
|
|||
7 | exit 1 |
|
|||
8 | EOF |
|
|||
9 | chmod +x $HGTMP/false |
|
|||
10 |
|
17 | |||
11 | hg init foo |
|
18 | hg init foo | |
12 | cd foo |
|
19 | cd foo | |
@@ -15,7 +22,7 b' hg add foo' | |||||
15 |
|
22 | |||
16 | # mq may keep a reference to the repository so __del__ will not be called |
|
23 | # mq may keep a reference to the repository so __del__ will not be called | |
17 | # and .hg/journal.dirstate will not be deleted: |
|
24 | # and .hg/journal.dirstate will not be deleted: | |
18 | HGEDITOR=$HGTMP/false hg ci |
|
25 | hg ci -m foo | |
19 | HGEDITOR=$HGTMP/false hg ci |
|
26 | hg ci -m foo | |
20 |
|
27 | |||
21 | exit 0 |
|
28 | exit 0 |
@@ -1,6 +1,8 b'' | |||||
1 | abort: edit failed: false exited with status 1 |
|
1 | error: pretxncommit.nocommits hook failed: no commits allowed | |
|
2 | abort: no commits allowed | |||
2 | transaction abort! |
|
3 | transaction abort! | |
3 | rollback completed |
|
4 | rollback completed | |
4 | abort: edit failed: false exited with status 1 |
|
5 | error: pretxncommit.nocommits hook failed: no commits allowed | |
|
6 | abort: no commits allowed | |||
5 | transaction abort! |
|
7 | transaction abort! | |
6 | rollback completed |
|
8 | rollback completed |
General Comments 0
You need to be logged in to leave comments.
Login now