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