~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to doc/en/user-guide/hooks.txt

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-12-20 16:16:34 UTC
  • mfrom: (3123.5.18 hardlinks)
  • Revision ID: pqm@pqm.ubuntu.com-20071220161634-2kcjb650o21ydko4
Accelerate build_tree using similar workingtrees (abentley)

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
        print "The new revno is %d" % push_result.new_revno
23
23
 
24
24
 
25
 
    branch.Branch.hooks.install_named_hook('post_push', post_push_hook,
26
 
                                     'My post_push hook')
 
25
    branch.Branch.hooks.install_hook('post_push', post_push_hook)
 
26
    branch.Branch.hooks.name_hook(post_push_hook, 'My post_push hook')
27
27
 
28
28
To use this example, create a file named ``push_hook.py``, and stick it in
29
29
``plugins`` subdirectory of your configuration directory.  (If you have never
34
34
single argument, the ``push_result``.
35
35
 
36
36
Next, we install the hook.  ``'post_push'`` identifies where we want to install
37
 
the hook, and the second parameter is the hook itself.  We also give the hook a
38
 
name 'My post_push hook', which can be used in progress messages and error
39
 
messages.
 
37
the hook, and the second parameter is the hook itself.
 
38
 
 
39
Finally, we name the hook.  This is optional, but it means the hook name can
 
40
be used in progress messages and error messages.
40
41
 
41
42
That's it!  The next time you push, it should show "The new revno is...".
42
43
Of course, hooks can be much more elaborate than this, because you have the
48
49
 
49
50
For a complete list of hooks and their parameters, see `Hooks
50
51
<../user-reference/bzr_man.html#hooks>`_ in the User Reference.
51
 
 
52
 
Debugging hooks
53
 
---------------
54
 
 
55
 
To get a list of installed hooks, use the hidden ``hooks`` command::
56
 
 
57
 
    bzr hooks