tests/test-abort-checkin.t
author Mads Kiilerich <mads@kiilerich.com>
Sat, 14 Jan 2012 01:56:27 +0100
branchstable
changeset 15942 d7a34c07e69b
parent 12327 92e30e135581
child 16913 f2719b387380
permissions -rw-r--r--
run-tests: expand user in --with-hg This makes it possible to run: $ ./run-tests.py --with-hg=~/hg-bin/hg

  $ 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]