I have a hook function named precommit_bad_branch
which imports hook_utils
. When invoking precommit_bad_branch
via a commit I get the following error message:
error: precommit.branch_check hook raised an exception: No module named hook_utils
abort: No module named hook_utils!
It looks like I'm not allowed to call hook_utils
from precommit_bad_branch
. The code works fine if I call it explicitly without involving Mercurial.
Is it possible for my hook to call code from another file?
My hgrc hook part looks like this:
[hooks]
precommit.branch_check = python:C:\workspaces\hg_hooks\next_hooks.py:precommit_bad_branch
precommit.debug_code_check = python:C:\workspaces\hg_hooks\common_hooks.py:precommit_contains_debug_code
preupdate.merge_check = python:C:\workspaces\hg_hooks\next_hooks.py:preupdate_bad_merge