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