##// END OF EJS Templates
tests: unify test-abort-checkin
Martin Geisler -
r11848:f54ff493 default
parent child Browse files
Show More
@@ -1,28 +1,33 b''
1 #!/bin/sh
1 $ cat > abortcommit.py <<EOF
2
2 > from mercurial import util
3 cat > abortcommit.py <<EOF
3 > def hook(**args):
4 from mercurial import util
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):
10 $ echo "[extensions]" >> $HGRCPATH
7 raise util.Abort("no commits allowed")
11 $ echo "mq=" >> $HGRCPATH
8
12 $ echo "abortcommit = $abspath" >> $HGRCPATH
9 def reposetup(ui, repo):
10 repo.ui.setconfig("hooks", "pretxncommit.nocommits", hook)
11 EOF
12 abspath=`pwd`/abortcommit.py
13
13
14 echo "[extensions]" >> $HGRCPATH
14 $ hg init foo
15 echo "mq=" >> $HGRCPATH
15 $ cd foo
16 echo "abortcommit = $abspath" >> $HGRCPATH
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
22 $ hg ci -m foo
19 cd foo
23 error: pretxncommit.nocommits hook failed: no commits allowed
20 echo foo > foo
24 transaction abort!
21 hg add foo
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
33 $ exit 0
24 # and .hg/journal.dirstate will not be deleted:
25 hg ci -m foo
26 hg ci -m foo
27
28 exit 0
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now