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

2

6

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

Koheleth answered 7/2, 2011 at 19:53 Comment(0)
S
9

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='[]'
Stream answered 7/2, 2011 at 21:1 Comment(0)
A
8

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

Aslam answered 7/2, 2011 at 20:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.