how do I register a pre-commit hook from Python?

Created by Martin Pool on on 2010-01-08
Keywords:
plugin hooks api

Erik de Castro Lopo wrote:
> Erik de Castro Lopo wrote:
>
>> Thanks John, thats enough to get me started.
>
> Actually its not. What do I need in the __init__.py file to
> register the pre-commit-hook. All the examples I can find
> are for registering a new command.
>
> Erik

from bzrlib import branch
branch.Branch.hooks.install_named_hook('pre_commit', copyright_hook, 'copyright-hook')