Search code examples
pythonmercurialmercurial-hook

Mercurial avoid pre-commit hook on shelving


I'm coding a simple hook in order to check syntax of project's files. I want check syntax only before a commit.

My problem is : When I do a shelve, Mercurial run pre-commit hook. The syntax checking take 4-5 minutes.

How can I avoid to run my hook on shelve ?

My .hrgc line of hook :

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

I can add parameter in my check_syntax.py to avoid checking if it's required.


Solution

  • You can just override the config for this particular command invocation:

    hg shelve --config hooks.precommit= --name abcd