I'm afraid there's no built-in debugging capabilities for this. What I do when writing a hook is to setup two local repositories:
$ hg init repo
$ hg clone repo clone
and then configure the changegroup
hook in repo
. Now go into clone
and do
$ echo a > a
$ hg add a
$ hg commit -m 'a file'
to setup clone
. Every time I want to check the hook, I run
$ hg push; hg -R ../repo rollback
inside clone
. I keep that in my command line history so that I can just press ↑ + Return to execute it again and again. The hg rollback
is the key: is effectively cancels the hg push
so that I can repeat it again and again.
You will of course need to adjust this as needed for your hook. If the hook checks the committer name, then use hg commit -u someone
to set this as needed. If the hook needs more than one changeset in the changegroup, then make two or more commits before pushing — rollback will take care of removing all the pushed changesets. If the hook is run by hgweb
, then run
$ hg serve --config 'web.push_ssl=no' --config 'web.allow_push=*'
in one terminal to serve repo
while you push to it in another terminal.