OultimoCoder
OultimoCoder

Reputation: 294

How do I find out where the Mercurial hook file is being called from?

On the project I am working on there is a standard pre-commit hook for mercurial that looks something like this:

python:hookhgext.messagevalidation.checkCommitMessage

I would like to find out where the python script is located so I can create my own hook script that also calls this.

How would I either find the location of this file or also call this hook from a python script?

Upvotes: 1

Views: 42

Answers (1)

Lazy Badger
Lazy Badger

Reputation: 97285

Accoring to docs

The value of the hook must start with the text “python:”, and continue with the fully-qualified name of a callable object to use as the hook's value. … So long as you have the module name and PYTHONPATH right, it should “just work”

I.e. in your case Mercurial imports hookhgext.messagevalidation (from any possible for import location) and call checkCommitMessage from it.

I know nothing about Python, but for me hookhgext.messagevalidation is "messagevalidation" something inside "hookhgext.py", and "hookhgext" is the usual installed python-module in it's (installed modules) default location(s)

Upvotes: 1

Related Questions