tests/test-abort-checkin
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Sun, 04 Mar 2007 14:35:11 -0300
changeset 4140 193e0f8d9a47
parent 2990 61fcd9fac434
permissions -rwxr-xr-x
test-abort-checkin: use a hook to abort the commit This should make it more portable.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2726
6bd351194a96 Add test mq keeping a reference to localrepo which can't remove journal on exit.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     1
#!/bin/sh
6bd351194a96 Add test mq keeping a reference to localrepo which can't remove journal on exit.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     2
4140
193e0f8d9a47 test-abort-checkin: use a hook to abort the commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2990
diff changeset
     3
cat > abortcommit.py <<EOF
193e0f8d9a47 test-abort-checkin: use a hook to abort the commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2990
diff changeset
     4
from mercurial import util
193e0f8d9a47 test-abort-checkin: use a hook to abort the commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2990
diff changeset
     5
193e0f8d9a47 test-abort-checkin: use a hook to abort the commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2990
diff changeset
     6
def hook(**args):
193e0f8d9a47 test-abort-checkin: use a hook to abort the commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2990
diff changeset
     7
    raise util.Abort("no commits allowed")
193e0f8d9a47 test-abort-checkin: use a hook to abort the commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2990
diff changeset
     8
193e0f8d9a47 test-abort-checkin: use a hook to abort the commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2990
diff changeset
     9
def reposetup(ui, repo):
193e0f8d9a47 test-abort-checkin: use a hook to abort the commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2990
diff changeset
    10
    repo.ui.setconfig("hooks", "pretxncommit.nocommits", hook)
193e0f8d9a47 test-abort-checkin: use a hook to abort the commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2990
diff changeset
    11
EOF
193e0f8d9a47 test-abort-checkin: use a hook to abort the commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2990
diff changeset
    12
abspath=`pwd`/abortcommit.py
193e0f8d9a47 test-abort-checkin: use a hook to abort the commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2990
diff changeset
    13
2990
61fcd9fac434 Make tests append settings to $HGRCPATH instead of $HGTMP/.hgrc
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2843
diff changeset
    14
echo "[extensions]" >> $HGRCPATH
61fcd9fac434 Make tests append settings to $HGRCPATH instead of $HGTMP/.hgrc
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2843
diff changeset
    15
echo "mq=" >> $HGRCPATH
4140
193e0f8d9a47 test-abort-checkin: use a hook to abort the commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2990
diff changeset
    16
echo "abortcommit = $abspath" >> $HGRCPATH
2726
6bd351194a96 Add test mq keeping a reference to localrepo which can't remove journal on exit.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    17
6bd351194a96 Add test mq keeping a reference to localrepo which can't remove journal on exit.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    18
hg init foo
6bd351194a96 Add test mq keeping a reference to localrepo which can't remove journal on exit.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    19
cd foo
6bd351194a96 Add test mq keeping a reference to localrepo which can't remove journal on exit.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    20
echo foo > foo
6bd351194a96 Add test mq keeping a reference to localrepo which can't remove journal on exit.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    21
hg add foo
6bd351194a96 Add test mq keeping a reference to localrepo which can't remove journal on exit.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    22
6bd351194a96 Add test mq keeping a reference to localrepo which can't remove journal on exit.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    23
# mq may keep a reference to the repository so __del__ will not be called
6bd351194a96 Add test mq keeping a reference to localrepo which can't remove journal on exit.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    24
# and .hg/journal.dirstate will not be deleted:
4140
193e0f8d9a47 test-abort-checkin: use a hook to abort the commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2990
diff changeset
    25
hg ci -m foo
193e0f8d9a47 test-abort-checkin: use a hook to abort the commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2990
diff changeset
    26
hg ci -m foo
2726
6bd351194a96 Add test mq keeping a reference to localrepo which can't remove journal on exit.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    27
6bd351194a96 Add test mq keeping a reference to localrepo which can't remove journal on exit.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    28
exit 0