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
Called after a Branch object is opened, with the Branch object.
27
Run after ``push`` has completed.
29
The hook signature is (push_result), containing the members
32
Where the data is being pushed from (read locked).
33
This should be the lowest latency branch.
36
The direct location where data is being sent (write locked).
39
Either target_branch, or if the target is a bound branch, it
40
will be the master location (write locked).
43
If the target is a bound branch, this will be the target
44
branch, else it will be None.
47
The revision number (eg 10) of the branch before the push.
50
The revision id (eg joe@foo.com-1234234-aoeua34) before the push.
53
The revision number (eg 12) of the branch after the push.
56
The revision id (eg joe@foo.com-5676566-boa234a) after the push.
62
Run after ``pull`` has completed.
64
The hook signature is (push_result) containing the members
65
(source, local, master, old_revno, old_revid, new_revno, new_revid)
66
where local is the local target branch or None, master is the target
67
master branch, and the rest should be self explanatory. The source
68
is read-locked and the target branches are write-locked. Source will
69
be the local low-latency branch.
72
start_commit (MutableTree)
73
--------------------------
75
Run on the working tree before ``commit`` starts processing it.
76
Unlike the ``pre_commit`` hook (see below), the ``start_commit`` hook
77
can safely change the working tree.
79
The hook signature is (tree) where tree is a MutableTree object.
85
Run before ``commit`` has completed.
87
The hook signature is (local, master, old_revno, old_revid, future_revno,
88
future_revid, tree_delta, future_tree) where old_revno is NULL_REVISION for
89
the first commit to a branch, tree_delta is a TreeDelta object describing
90
changes from the basis revision, and future_tree is an in-memory tree
91
obtained from CommitBuilder.revision_tree(). Hooks MUST NOT modify tree_delta
98
Run after ``commit`` has completed.
100
The hook signature is (local, master, old_revno, old_revid, new_revno,
101
new_revid) old_revid is NULL_REVISION for the first commit to a branch.
104
post_uncommit (Branch)
105
----------------------
107
Run after ``uncommit`` has completed.
109
The api signature is (local, master, old_revno, old_revid, new_revno,
110
new_revid) where local is the local branch or None, master is the target
111
branch, and an empty branch receives new_revno of 0, new_revid of None.
114
pre_change_branch_tip (Branch)
115
-------------------------------
117
Run before a branch tip has been changed, while the branch is write-locked.
118
Note that push, pull, commit and uncommit all invoke this hook.
120
The hook signature is (params), where params is an object containing
124
The branch whose tip has been changed.
127
The revision number (eg 10) of the branch before the change.
130
The revision id (eg joe@foo.com-1234234-aoeua34) before the change.
133
The revision number (eg 12) of the branch after the change.
136
The revision id (eg joe@foo.com-5676566-boa234a) after the change.
138
The old_revno and new_revno members are integers, as the head
139
revision never has a dotted revision number.
142
post_change_branch_tip (Branch)
143
-------------------------------
145
Run after a branch tip has been changed but while the branch is still
146
write-locked. Note that push, pull, commit and uncommit all invoke this hook.
148
The hook signature is (params), where params is an object containing
152
The branch whose tip has been changed.
155
The revision number (eg 10) of the branch before the change.
158
The revision id (eg joe@foo.com-1234234-aoeua34) before the change.
161
The revision number (eg 12) of the branch after the change.
164
The revision id (eg joe@foo.com-5676566-boa234a) after the change.
166
The old_revno and new_revno members are integers, as the head
167
revision never has a dotted revision number.
173
Note: This hook is now deprecated and will be removed in the near future.
174
Please use the ``post_change_branch_tip`` hook instead.
177
server_started (SmartTCPServer)
178
-------------------------------
180
Invoked whenever the server starts serving a directory.
181
The hook signature is (backing urls, public url), where:
184
A list of (string) URLs giving the server-specific directory locations.
187
The public URL for the directory.
190
server_stopped (SmartTCPServer)
191
-------------------------------
193
Invoked whenever the server stops serving a directory.
194
The hook signature is the same as ``server_started``.