2

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

jfabre
  • 514
  • 5
  • 13

2 Answers2

2

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)

shellholic
  • 5,974
  • 1
  • 20
  • 30
  • +1 for this one, but the real problem was that the variable was inaccessible from that hook. Thanks though! – jfabre Oct 28 '11 at 13:25
2

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.

jfabre
  • 514
  • 5
  • 13