summaryrefslogtreecommitdiff
path: root/tests/test-abort-checkin.t
diff options
context:
space:
mode:
authorLorry <lorry@roadtrain.codethink.co.uk>2012-08-22 14:49:51 +0100
committerLorry <lorry@roadtrain.codethink.co.uk>2012-08-22 14:49:51 +0100
commita498da43c7fdb9f24b73680c02a4a3588cc62d9a (patch)
treedaf8119dae1749b5165b68033a1b23a7375ce9ce /tests/test-abort-checkin.t
downloadmercurial-tarball-a498da43c7fdb9f24b73680c02a4a3588cc62d9a.tar.gz
Tarball conversion
Diffstat (limited to 'tests/test-abort-checkin.t')
-rw-r--r--tests/test-abort-checkin.t35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/test-abort-checkin.t b/tests/test-abort-checkin.t
new file mode 100644
index 0000000..c7a3c98
--- /dev/null
+++ b/tests/test-abort-checkin.t
@@ -0,0 +1,35 @@
+ $ cat > abortcommit.py <<EOF
+ > from mercurial import util
+ > def hook(**args):
+ > raise util.Abort("no commits allowed")
+ > def reposetup(ui, repo):
+ > repo.ui.setconfig("hooks", "pretxncommit.nocommits", hook)
+ > EOF
+ $ abspath=`pwd`/abortcommit.py
+
+ $ echo "[extensions]" >> $HGRCPATH
+ $ echo "mq=" >> $HGRCPATH
+ $ echo "abortcommit = $abspath" >> $HGRCPATH
+
+ $ hg init foo
+ $ cd foo
+ $ echo foo > foo
+ $ hg add foo
+
+mq may keep a reference to the repository so __del__ will not be
+called and .hg/journal.dirstate will not be deleted:
+
+ $ hg ci -m foo
+ error: pretxncommit.nocommits hook failed: no commits allowed
+ transaction abort!
+ rollback completed
+ abort: no commits allowed
+ [255]
+ $ hg ci -m foo
+ error: pretxncommit.nocommits hook failed: no commits allowed
+ transaction abort!
+ rollback completed
+ abort: no commits allowed
+ [255]
+
+ $ cd ..