7
A hook of type *xxx* of class *yyy* needs to be registered using::
9
yyy.hooks.install_named_hook("xxx", ...)
11
See `Using hooks`_ in the User Guide for examples.
13
.. _Using hooks: ../user-guide/index.html#using-hooks
15
The class of each hook is given immediately after each hook type below.
21
Run after ``push`` has completed.
23
The hook signature is (push_result), containing the members
26
Where the data is being pushed from (read locked).
27
This should be the lowest latency branch.
30
The direct location where data is being sent (write locked).
33
Either target_branch, or if the target is a bound branch, it
34
will be the master location (write locked).
37
If the target is a bound branch, this will be the target
38
branch, else it will be None.
41
The revision number (eg 10) of the branch before the push.
44
The revision id (eg joe@foo.com-1234234-aoeua34) before the push.
47
The revision number (eg 12) of the branch after the push.
50
The revision id (eg joe@foo.com-5676566-boa234a) after the push.
56
Run after ``pull`` has completed.
58
The hook signature is (push_result) containing the members
59
(source, local, master, old_revno, old_revid, new_revno, new_revid)
60
where local is the local target branch or None, master is the target
61
master branch, and the rest should be self explanatory. The source
62
is read-locked and the target branches are write-locked. Source will
63
be the local low-latency branch.
66
start_commit (MutableTree)
67
--------------------------
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.
73
The hook signature is (tree) where tree is a MutableTree object.
79
Run before ``commit`` has completed.
81
The hook signature is (local, master, old_revno, old_revid, future_revno,
82
future_revid, tree_delta, future_tree) where old_revno is NULL_REVISION for
83
the first commit to a branch, tree_delta is a TreeDelta object describing
84
changes from the basis revision, and future_tree is an in-memory tree
85
obtained from CommitBuilder.revision_tree(). Hooks MUST NOT modify tree_delta
92
Run after ``commit`` has completed.
94
The hook signature is (local, master, old_revno, old_revid, new_revno,
95
new_revid) old_revid is NULL_REVISION for the first commit to a branch.
98
post_uncommit (Branch)
99
----------------------
101
Run after ``uncommit`` has completed.
103
The api signature is (local, master, old_revno, old_revid, new_revno,
104
new_revid) where local is the local branch or None, master is the target
105
branch, and an empty branch receives new_revno of 0, new_revid of None.
108
pre_change_branch_tip (Branch)
109
-------------------------------
111
Run before a branch tip has been changed, while the branch is write-locked.
112
Note that push, pull, commit and uncommit all invoke this hook.
114
The hook signature is (params), where params is an object containing
118
The branch whose tip has been changed.
121
The revision number (eg 10) of the branch before the change.
124
The revision id (eg joe@foo.com-1234234-aoeua34) before the change.
127
The revision number (eg 12) of the branch after the change.
130
The revision id (eg joe@foo.com-5676566-boa234a) after the change.
132
The old_revno and new_revno members are integers, as the head
133
revision never has a dotted revision number.
136
post_change_branch_tip (Branch)
137
-------------------------------
139
Run after a branch tip has been changed but while the branch is still
140
write-locked. Note that push, pull, commit and uncommit all invoke this hook.
142
The hook signature is (params), where params is an object containing
146
The branch whose tip has been changed.
149
The revision number (eg 10) of the branch before the change.
152
The revision id (eg joe@foo.com-1234234-aoeua34) before the change.
155
The revision number (eg 12) of the branch after the change.
158
The revision id (eg joe@foo.com-5676566-boa234a) after the change.
160
The old_revno and new_revno members are integers, as the head
161
revision never has a dotted revision number.
167
Note: This hook is now deprecated and will be removed in the near future.
168
Please use the ``post_change_branch_tip`` hook instead.
171
server_started (SmartTCPServer)
172
-------------------------------
174
Invoked whenever the server starts serving a directory.
175
The hook signature is (backing urls, public url), where:
178
A list of (string) URLs giving the server-specific directory locations.
181
The public URL for the directory.
184
server_stopped (SmartTCPServer)
185
-------------------------------
187
Invoked whenever the server stops serving a directory.
188
The hook signature is the same as ``server_started``.