~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/help_topics/en/hooks.txt

  • Committer: John Arbash Meinel
  • Date: 2008-05-29 19:46:01 UTC
  • mfrom: (3456 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3459.
  • Revision ID: john@arbash-meinel.com-20080529194601-r2gpmk536xin9c4a
merge bzr.dev, put the NEWS entry in the right place

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
Hooks
2
2
=====
3
3
 
4
 
post_push
5
 
---------
 
4
Introduction
 
5
------------
 
6
 
 
7
A hook of type *xxx* of class *yyy* needs to be registered using::
 
8
 
 
9
  yyy.hooks.install_named_hook("xxx", ...)
 
10
 
 
11
See `Using hooks`_ in the User Guide for examples.
 
12
 
 
13
.. _Using hooks: ../user-guide/index.html#using-hooks
 
14
 
 
15
The class of each hook is given immediately after each hook type below.
 
16
 
 
17
 
 
18
post_push (Branch)
 
19
------------------
6
20
 
7
21
Run after ``push`` has completed.
8
22
 
35
49
  new_revid
36
50
    The revision id (eg joe@foo.com-5676566-boa234a) after the push.
37
51
 
38
 
post_pull
39
 
---------
 
52
 
 
53
post_pull (Branch)
 
54
------------------
40
55
 
41
56
Run after ``pull`` has completed.
42
57
 
47
62
is read-locked and the target branches are write-locked. Source will
48
63
be the local low-latency branch.
49
64
 
50
 
pre_commit
51
 
----------
52
 
 
53
 
Run prefore ``commit`` has completed.
 
65
 
 
66
start_commit (MutableTree)
 
67
--------------------------
 
68
 
 
69
Run on the working tree before ``commit`` starts processing it.
 
70
Unlike the ``pre_commit`` hook (see below), the ``start_commit`` hook
 
71
can safely change the working tree.
 
72
 
 
73
The hook signature is (tree) where tree is a MutableTree object.
 
74
 
 
75
 
 
76
pre_commit (Branch)
 
77
-------------------
 
78
 
 
79
Run before ``commit`` has completed.
54
80
 
55
81
The hook signature is (local, master, old_revno, old_revid, future_revno,
56
82
future_revid, tree_delta, future_tree) where old_revno is NULL_REVISION for
59
85
obtained from CommitBuilder.revision_tree(). Hooks MUST NOT modify tree_delta
60
86
and future_tree.
61
87
 
62
 
post_commit
63
 
-----------
 
88
 
 
89
post_commit (Branch)
 
90
--------------------
64
91
 
65
92
Run after ``commit`` has completed.
66
93
 
67
94
The hook signature is (local, master, old_revno, old_revid, new_revno,
68
95
new_revid) old_revid is NULL_REVISION for the first commit to a branch.
69
96
 
70
 
post_uncommit
71
 
-------------
 
97
 
 
98
post_uncommit (Branch)
 
99
----------------------
72
100
 
73
101
Run after ``uncommit`` has completed.
74
102
 
76
104
new_revid) where local is the local branch or None, master is the target
77
105
branch, and an empty branch receives new_revno of 0, new_revid of None.
78
106
 
79
 
set_rh
80
 
------
81
 
 
82
 
Run after the branch's revision history has been modified (push, pull, commit
83
 
and uncommit can all modify the revision history).
84
 
 
85
 
The hook signature is (branch, revision_history), and the branch will be
86
 
write-locked.
87
 
 
88
 
See also `Using hooks`_ in the User Guide.
89
 
 
90
 
.. _Using hooks: ../user-guide/index.html#using-hooks
 
107
 
 
108
post_change_branch_tip (Branch)
 
109
-------------------------------
 
110
 
 
111
Run after a branch tip has been changed but while the branch is still
 
112
write-locked. Note that push, pull, commit and uncommit all invoke this hook.
 
113
 
 
114
The hook signature is (params), where params is an object containing
 
115
the members
 
116
 
 
117
  branch
 
118
    The branch whose tip has been changed.
 
119
 
 
120
  old_revno
 
121
    The revision number (eg 10) of the branch before the change.
 
122
 
 
123
  old_revid
 
124
    The revision id (eg joe@foo.com-1234234-aoeua34) before the change.
 
125
 
 
126
  new_revno
 
127
    The revision number (eg 12) of the branch after the change.
 
128
 
 
129
  new_revid
 
130
    The revision id (eg joe@foo.com-5676566-boa234a) after the change.
 
131
 
 
132
The old_revno and new_revno members are integers, as the head
 
133
revision is never has a dotted revision number.
 
134
 
 
135
 
 
136
set_rh (Branch)
 
137
---------------
 
138
 
 
139
Note: This hook is now deprecated and will be removed in the near future.
 
140
Please use the ``post_change_branch_tip`` hook instead.
 
141
 
 
142
 
 
143
server_started (SmartTCPServer)
 
144
-------------------------------
 
145
 
 
146
Invoked whenever the server starts serving a directory.
 
147
The hook signature is (backing urls, public url), where:
 
148
 
 
149
  backing_url
 
150
    A list of (string) URLs giving the server-specific directory locations.
 
151
 
 
152
  public_url
 
153
    The public URL for the directory.
 
154
 
 
155
 
 
156
server_stopped (SmartTCPServer)
 
157
-------------------------------
 
158
 
 
159
Invoked whenever the server stops serving a directory.
 
160
The hook signature is the same as ``server_started``.