comparison tests/test-abort-checkin @ 4140:193e0f8d9a47

test-abort-checkin: use a hook to abort the commit This should make it more portable.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sun, 04 Mar 2007 14:35:11 -0300
parents 61fcd9fac434
children
comparison
equal deleted inserted replaced
4139:efe6f92c0847 4140:193e0f8d9a47
1 #!/bin/sh 1 #!/bin/sh
2
3 cat > abortcommit.py <<EOF
4 from mercurial import util
5
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
2 13
3 echo "[extensions]" >> $HGRCPATH 14 echo "[extensions]" >> $HGRCPATH
4 echo "mq=" >> $HGRCPATH 15 echo "mq=" >> $HGRCPATH
5 cat > $HGTMP/false <<EOF 16 echo "abortcommit = $abspath" >> $HGRCPATH
6 #!/bin/sh
7 exit 1
8 EOF
9 chmod +x $HGTMP/false
10 17
11 hg init foo 18 hg init foo
12 cd foo 19 cd foo
13 echo foo > foo 20 echo foo > foo
14 hg add foo 21 hg add foo
15 22
16 # mq may keep a reference to the repository so __del__ will not be called 23 # mq may keep a reference to the repository so __del__ will not be called
17 # and .hg/journal.dirstate will not be deleted: 24 # and .hg/journal.dirstate will not be deleted:
18 HGEDITOR=$HGTMP/false hg ci 25 hg ci -m foo
19 HGEDITOR=$HGTMP/false hg ci 26 hg ci -m foo
20 27
21 exit 0 28 exit 0