tests/test-abort-checkin.t
author Thomas Arendsen Hein <thomas@intevation.de>
Mon, 16 May 2011 11:41:48 +0200
changeset 14331 3b9a896af09c
parent 12327 92e30e135581
child 16913 f2719b387380
permissions -rw-r--r--
paths: Add support for -q/--quiet Suppresses output (resolved paths or "not found!") when searching a path, similar to "grep -q". Sample usage: hg paths -q foo || echo "there is no foo" Just prints path names (instead of "name = result") when listing all path definitions, like "hg bookmarks -q". Sample usage: hg paths -q | while read i; do hg incoming "$i"; done

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