6

标题说:我正在寻找变量名 (HG_*),以便我可以在我的钩子脚本中使用它们。

4

2 回答 2

9

Oben 有您最好的答案,但对于特定情况或记录不充分的选项,您可以使用仅打印变量的钩子轻松测试特定钩子:

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

wherepre-commit可以是您想要测试的任何钩子,commit也可以是您想要测试的任何命令。

例如,一个显示:

export HG_ARGS='commit'
export HG_OPTS='{'"'"'exclude'"'"': [], '"'"'message'"'"': '"''"', '"'"'addremove'"'"': None, '"'"'include'"'"': [], '"'"'close_branch'"'"': None, '"'"'user'"'"': '"''"', '"'"'date'"'"': '"''"', '"'"'logfile'"'"': '"''"', '"'"'mq'"'"': None}'
export HG_PATS='[]'
于 2011-02-07T21:01:44.743 回答
8

hgrc 联机帮助页中的hooks 部分列出了所有已定义的 hooks,包括每个 hooks 可用的环境变量。

于 2011-02-07T20:39:24.727 回答