Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use a relative pathname to a Mercurial hook

I have a script that is in the top level of my working copy and would like to use it as a Mercurial hook. If I use an absolute pathname to the hook then everything is fine, but I want a relative pathname so the whole thing can be easily moved around, used in other working copies and other developers can copy the hgrc as is.

/space/project/.hg/hgrc contains

[hooks]
update = genid

The genid script is at /space/project/genid

The hook is invoked just fine if I am in /space/project but if my current directory is /space/project/src/tools then 'hg update' will give an error as the hook cannot be found.

like image 806
Roger Binns Avatar asked Oct 13 '22 20:10

Roger Binns


1 Answers

Python hooks cannot use a relative path. Script hooks can like this:

[hooks]
update = ./genid
like image 120
Roger Binns Avatar answered Nov 09 '22 11:11

Roger Binns