Mercurial > hg
view tests/test-abort-checkin.t @ 44009:e685fac56693
match: resolve filesets against the passed `cwd`, not the current one
This allows filesets to be resolved relative to `repo.root`, the same as other
patterns are since f02d3c0eed18. The current example in contrib/ wasn't working
from the tests directory because of this.
Differential Revision: https://phab.mercurial-scm.org/D7570
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 06 Dec 2019 20:40:02 -0500 |
parents | f798709eb4b9 |
children |
line wrap: on
line source
$ cat > abortcommit.py <<EOF > from mercurial import error > def hook(**args): > raise error.Abort(b"no commits allowed") > def reposetup(ui, repo): > repo.ui.setconfig(b"hooks", b"pretxncommit.nocommits", hook) > EOF $ abspath=`pwd`/abortcommit.py $ cat <<EOF >> $HGRCPATH > [extensions] > mq = > abortcommit = $abspath > EOF $ 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 ..