2010-08-14 04:03:01 +04:00
|
|
|
$ cat > abortcommit.py <<EOF
|
2019-01-30 03:25:33 +03:00
|
|
|
> from edenscm.mercurial import error
|
2010-08-14 04:03:01 +04:00
|
|
|
> def hook(**args):
|
2015-10-08 22:55:45 +03:00
|
|
|
> raise error.Abort("no commits allowed")
|
2010-08-14 04:03:01 +04:00
|
|
|
> def reposetup(ui, repo):
|
|
|
|
> repo.ui.setconfig("hooks", "pretxncommit.nocommits", hook)
|
|
|
|
> EOF
|
|
|
|
$ abspath=`pwd`/abortcommit.py
|
|
|
|
|
2014-11-04 17:41:46 +03:00
|
|
|
$ cat <<EOF >> $HGRCPATH
|
|
|
|
> [extensions]
|
|
|
|
> mq =
|
|
|
|
> abortcommit = $abspath
|
|
|
|
> EOF
|
2010-08-14 04:03:01 +04:00
|
|
|
|
|
|
|
$ 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
|
2010-09-17 02:51:32 +04:00
|
|
|
[255]
|
2010-08-14 04:03:01 +04:00
|
|
|
$ hg ci -m foo
|
|
|
|
error: pretxncommit.nocommits hook failed: no commits allowed
|
|
|
|
transaction abort!
|
|
|
|
rollback completed
|
|
|
|
abort: no commits allowed
|
2010-09-17 02:51:32 +04:00
|
|
|
[255]
|
2012-06-11 03:40:51 +04:00
|
|
|
|
|
|
|
$ cd ..
|