Mercurial > hg > mercurial-source
comparison tests/test-abort-checkin.t @ 11848:f54ff49393fb
tests: unify test-abort-checkin
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Sat, 14 Aug 2010 02:03:01 +0200 |
parents | tests/test-abort-checkin@193e0f8d9a47 |
children | 4134686b83e1 |
comparison
equal
deleted
inserted
replaced
11847:1eb77c1a281f | 11848:f54ff49393fb |
---|---|
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 | |
9 | |
10 $ echo "[extensions]" >> $HGRCPATH | |
11 $ echo "mq=" >> $HGRCPATH | |
12 $ echo "abortcommit = $abspath" >> $HGRCPATH | |
13 | |
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: | |
21 | |
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 | |
32 | |
33 $ exit 0 |