简体   繁体   English

Windows上的Mercurial HG_NODE挂钩变量

[英]Mercurial HG_NODE hook variable on windows

I'm currently testing mercurial hooks on windows and it seems like I cannot access hook variables.... 我目前正在Windows上测试水银钩子,似乎无法访问钩子变量...。

here's hgrc content : 这是hgrc内容:

[hooks] [钩]
prechangegroup = ruby prechangegroup.rb test1 test2 $HG_NODE prechangegroup =红宝石prechangegroup.rb test1 test2 $ HG_NODE

I also tried with %HG_NODE% 我也尝试了%HG_NODE%

Here's prechangegroup.rb content 这是prechangegroup.rb的内容

ARGV.each do|a| ARGV.each do | a |
puts "Argument: #{a}" 放置“参数:#{a}”
end 结束

It prints out: 它输出:

Argument: test1 参数:test1
Argument: test2 参数:test2
Argument: $HG_NODE$ 参数:$ HG_NODE $

Followed by the normal push output... 随后是正常的推式输出...

Any idea? 任何想法? (probably something stupid but, I can't seem to find it) (可能有些愚蠢,但我似乎找不到它)

Thanks 谢谢

HG_NODE is an environmental variable. HG_NODE是环境变量。 You don't have to use it as arguments on the command line. 您不必在命令行上将其用作参数。 Instead, you should be able to use it as puts ENV['HG_NODE'] (found through search engine as I'm not a ruby guy) 相反,您应该可以将其用作puts ENV['HG_NODE'] (通过搜索引擎找到,因为我不是红宝石人)

OK, I found a good documentation right on mercurial's website. 好的,我在mercurial网站上找到了很好的文档。

http://www.selenic.com/mercurial/hgrc.5.html#hooks http://www.selenic.com/mercurial/hgrc.5.html#hooks

I tried with a variable other than %HG_NODE% like %HG_URL% and the variable worked. 我尝试使用%HG_NODE%以外的其他变量(例如%HG_URL%),并且该变量有效。 So it probably means that the variable is inaccessible from that hook. 因此,这可能意味着无法从该挂钩访问该变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM