Question

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

Was it helpful?

Solution 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.

OTHER TIPS

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)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top