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

Created by Martin Pool
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 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')