/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Andrew Bennetts
  • Date: 2008-05-07 22:47:56 UTC
  • mfrom: (3412 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3414.
  • Revision ID: andrew.bennetts@canonical.com-20080507224756-upxgmud0bdo4ysuf
Merge from bzr.dev.

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_hook('post_push', post_push_hook)
26
 
    branch.Branch.hooks.name_hook(post_push_hook, 'My post_push hook')
 
25
    branch.Branch.hooks.install_hook('post_push', post_push_hook,
 
26
                                     '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.
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.
 
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.
41
40
 
42
41
That's it!  The next time you push, it should show "The new revno is...".
43
42
Of course, hooks can be much more elaborate than this, because you have the