What are the hook parameters passed to external hook program/script?

2.2k views Asked by At

The title says it: I am looking for the variable names (HG_*) so I can make use of them in my hook script..

2

There are 2 answers

0
Oben Sonne On

The hooks section in the hgrc manpage lists all defined hooks, including the environment variables available for each hook.

0
Ry4an Brase On

Oben has your best answer, but for specific cases or poorly documented options you can easily test specific hooks using a hook that just prints variables:

hg --config hooks.pre-commit="export| grep HG_" commit

Where pre-commit can be any hook you want to test and commit can be any command you want to test.

For example that one showed:

export HG_ARGS='commit'
export HG_OPTS='{'"'"'exclude'"'"': [], '"'"'message'"'"': '"''"', '"'"'addremove'"'"': None, '"'"'include'"'"': [], '"'"'close_branch'"'"': None, '"'"'user'"'"': '"''"', '"'"'date'"'"': '"''"', '"'"'logfile'"'"': '"''"', '"'"'mq'"'"': None}'
export HG_PATS='[]'