0

I'm coding a script to check syntax of repository files.

So, I added to my .hgrc file this line :

precommit = python ~/tools/check_syntax.py

But I want get the path of repository in which I try to commit from check_syntax.py file.

Do you know a way to do that ?

Samuel Dauzon
  • 10,744
  • 13
  • 61
  • 94

1 Answers1

1

hg root will give you the top of your current working directory. So something like:

[hooks]
precommit = python ~/tools/check_syntax.py $($HG root)

will set the top of your current working directory as first argument of your script.

Christophe Muller
  • 4,850
  • 1
  • 23
  • 31