How to use relative path to Mercurial hook

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

/space/project/.hg/hgrc contains

[hooks]
update = genid

The genid script is located in / space / project / genid

The hook is called just fine if I go into / space / project, but if my current directory is / space / project / src / tools, then "hg update" will throw an error because the hook cannot be found.

+5
source share
3

Python . Script :

[hooks]
update = ./genid
+2

. , , .

[hooks]
update = $MercurialHooks/genid

. Faq (12) https://www.mercurial-scm.org/wiki/TipsAndTricks

+2

I had the same problem and could not solve it. The workaround was easy! I returned the file to the repo and just copied it to my .hg folder! Not perfect, but it's not that can change, and other repo users can still get a copy of the file

0
source

All Articles