简体   繁体   中英

Mercurial HG_NODE hook variable on windows

I'm currently testing mercurial hooks on windows and it seems like I cannot access hook variables....

here's hgrc content :

[hooks]
prechangegroup = ruby prechangegroup.rb test1 test2 $HG_NODE

I also tried with %HG_NODE%

Here's prechangegroup.rb content

ARGV.each do|a|
puts "Argument: #{a}"
end

It prints out:

Argument: test1
Argument: test2
Argument: $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. 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)

OK, I found a good documentation right on mercurial's website.

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. So it probably means that the variable is inaccessible from that hook.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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