/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 bzrlib/help_topics/en/hooks.txt

  • Committer: Aaron Bentley
  • Date: 2008-10-28 10:31:32 UTC
  • mto: (0.14.36 prepare-shelf)
  • mto: This revision was merged to the branch mainline in revision 3820.
  • Revision ID: aaron@aaronbentley.com-20081028103132-syota6mcye41kvqh
Update to use Tree.readlines, if possible.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Hooks
 
2
=====
 
3
 
 
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
open (Branch)
 
19
-------------
 
20
 
 
21
Called after a Branch object is opened, with the Branch object.
 
22
 
 
23
 
 
24
post_push (Branch)
 
25
------------------
 
26
 
 
27
Run after ``push`` has completed.
 
28
 
 
29
The hook signature is (push_result), containing the members
 
30
 
 
31
  source_branch
 
32
    Where the data is being pushed from (read locked).
 
33
    This should be the lowest latency branch.
 
34
 
 
35
  target_branch
 
36
    The direct location where data is being sent (write locked).
 
37
 
 
38
  master_branch
 
39
    Either target_branch, or if the target is a bound branch, it
 
40
    will be the master location (write locked).
 
41
 
 
42
  local_branch
 
43
    If the target is a bound branch, this will be the target
 
44
    branch, else it will be None.
 
45
 
 
46
  old_revno
 
47
    The revision number (eg 10) of the branch before the push.
 
48
 
 
49
  old_revid
 
50
    The revision id (eg joe@foo.com-1234234-aoeua34) before the push.
 
51
 
 
52
  new_revno
 
53
    The revision number (eg 12) of the branch after the push.
 
54
 
 
55
  new_revid
 
56
    The revision id (eg joe@foo.com-5676566-boa234a) after the push.
 
57
 
 
58
 
 
59
post_pull (Branch)
 
60
------------------
 
61
 
 
62
Run after ``pull`` has completed.
 
63
 
 
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.
 
70
 
 
71
 
 
72
start_commit (MutableTree)
 
73
--------------------------
 
74
 
 
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.
 
78
 
 
79
The hook signature is (tree) where tree is a MutableTree object.
 
80
 
 
81
 
 
82
pre_commit (Branch)
 
83
-------------------
 
84
 
 
85
Run before ``commit`` has completed.
 
86
 
 
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
 
92
and future_tree.
 
93
 
 
94
 
 
95
post_commit (Branch)
 
96
--------------------
 
97
 
 
98
Run after ``commit`` has completed.
 
99
 
 
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.
 
102
 
 
103
 
 
104
post_uncommit (Branch)
 
105
----------------------
 
106
 
 
107
Run after ``uncommit`` has completed.
 
108
 
 
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.
 
112
 
 
113
 
 
114
pre_change_branch_tip (Branch)
 
115
-------------------------------
 
116
 
 
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.
 
119
 
 
120
The hook signature is (params), where params is an object containing
 
121
the members
 
122
 
 
123
  branch
 
124
    The branch whose tip has been changed.
 
125
 
 
126
  old_revno
 
127
    The revision number (eg 10) of the branch before the change.
 
128
 
 
129
  old_revid
 
130
    The revision id (eg joe@foo.com-1234234-aoeua34) before the change.
 
131
 
 
132
  new_revno
 
133
    The revision number (eg 12) of the branch after the change.
 
134
 
 
135
  new_revid
 
136
    The revision id (eg joe@foo.com-5676566-boa234a) after the change.
 
137
 
 
138
The old_revno and new_revno members are integers, as the head
 
139
revision never has a dotted revision number.
 
140
 
 
141
 
 
142
post_change_branch_tip (Branch)
 
143
-------------------------------
 
144
 
 
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.
 
147
 
 
148
The hook signature is (params), where params is an object containing
 
149
the members
 
150
 
 
151
  branch
 
152
    The branch whose tip has been changed.
 
153
 
 
154
  old_revno
 
155
    The revision number (eg 10) of the branch before the change.
 
156
 
 
157
  old_revid
 
158
    The revision id (eg joe@foo.com-1234234-aoeua34) before the change.
 
159
 
 
160
  new_revno
 
161
    The revision number (eg 12) of the branch after the change.
 
162
 
 
163
  new_revid
 
164
    The revision id (eg joe@foo.com-5676566-boa234a) after the change.
 
165
 
 
166
The old_revno and new_revno members are integers, as the head
 
167
revision never has a dotted revision number.
 
168
 
 
169
 
 
170
set_rh (Branch)
 
171
---------------
 
172
 
 
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.
 
175
 
 
176
 
 
177
transform_fallback_location (Branch)
 
178
------------------------------------
 
179
 
 
180
Invoked as a stacked branch activates its fallback locations.
 
181
 
 
182
The hook signature is (branch, url) where:
 
183
 
 
184
  branch
 
185
    The branch being opened.  Note that as it does not yet have its
 
186
    fallback locations activated, the branch should be treated as
 
187
    half-built.
 
188
 
 
189
  url
 
190
    The URL that the branch specified for its fallback location.
 
191
 
 
192
The hook must return a URL for the branch containing the fallback
 
193
location. If multiple hooks are registered, the order in which they 
 
194
will be called is undefined and subject to change.
 
195
 
 
196
(New in 1.9)
 
197
 
 
198
 
 
199
server_started (SmartTCPServer)
 
200
-------------------------------
 
201
 
 
202
Invoked whenever the server starts serving a directory.
 
203
The hook signature is (backing urls, public url), where:
 
204
 
 
205
  backing_url
 
206
    A list of (string) URLs giving the server-specific directory locations.
 
207
 
 
208
  public_url
 
209
    The public URL for the directory.
 
210
 
 
211
 
 
212
server_stopped (SmartTCPServer)
 
213
-------------------------------
 
214
 
 
215
Invoked whenever the server stops serving a directory.
 
216
The hook signature is the same as ``server_started``.
 
217
 
 
218
 
 
219
lock_acquired (LockDir)
 
220
----------------------------
 
221
 
 
222
Called with a LockResult object when a lock has been successfully acquired.
 
223
(New in 1.8.)
 
224
 
 
225
lock_released (LockDir)
 
226
----------------------------
 
227
 
 
228
Called with a LockResult object when a lock has been successfully released.
 
229
(New in 1.8.)