33
33
known_hooks = registry.Registry()
34
# known_hooks registry contains
35
# tuple of (module, member name) which is the hook point
36
# module where the specific hooks are defined
37
# callable to get the empty specific Hooks for that attribute
34
38
known_hooks.register_lazy(('bzrlib.branch', 'Branch.hooks'), 'bzrlib.branch',
36
40
known_hooks.register_lazy(('bzrlib.bzrdir', 'BzrDir.hooks'), 'bzrlib.bzrdir',
38
42
known_hooks.register_lazy(('bzrlib.commands', 'Command.hooks'),
39
43
'bzrlib.commands', 'CommandHooks')
44
known_hooks.register_lazy(('bzrlib.info', 'hooks'),
45
'bzrlib.info', 'InfoHooks')
40
46
known_hooks.register_lazy(('bzrlib.lock', 'Lock.hooks'), 'bzrlib.lock',
48
known_hooks.register_lazy(('bzrlib.merge', 'Merger.hooks'), 'bzrlib.merge',
50
known_hooks.register_lazy(('bzrlib.msgeditor', 'hooks'), 'bzrlib.msgeditor',
42
52
known_hooks.register_lazy(('bzrlib.mutabletree', 'MutableTree.hooks'),
43
53
'bzrlib.mutabletree', 'MutableTreeHooks')
44
54
known_hooks.register_lazy(('bzrlib.smart.client', '_SmartClient.hooks'),
45
55
'bzrlib.smart.client', 'SmartClientHooks')
46
56
known_hooks.register_lazy(('bzrlib.smart.server', 'SmartTCPServer.hooks'),
47
57
'bzrlib.smart.server', 'SmartServerHooks')
58
known_hooks.register_lazy(
59
('bzrlib.version_info_formats.format_rio', 'RioVersionInfoBuilder.hooks'),
60
'bzrlib.version_info_formats.format_rio', 'RioVersionInfoBuilderHooks')
61
known_hooks.register_lazy(
62
('bzrlib.merge_directive', 'BaseMergeDirective.hooks'),
63
'bzrlib.merge_directive', 'MergeDirectiveHooks')
50
66
def known_hooks_key_to_object((module_name, member_name)):
167
183
:ivar introduced: A version tuple specifying what version the hook was
168
184
introduced in. None indicates an unknown version.
169
185
:ivar deprecated: A version tuple specifying what version the hook was
170
deprecated or superceded in. None indicates that the hook is not
171
superceded or deprecated. If the hook is superceded then the doc
186
deprecated or superseded in. None indicates that the hook is not
187
superseded or deprecated. If the hook is superseded then the doc
172
188
should describe the recommended replacement hook to register for.
173
189
:ivar doc: The docs for using the hook.
205
221
strings.append('Introduced in: %s' % introduced_string)
206
222
if self.deprecated:
207
223
deprecated_string = _format_version_tuple(self.deprecated)
209
deprecated_string = 'Not deprecated'
210
strings.append('Deprecated in: %s' % deprecated_string)
224
strings.append('Deprecated in: %s' % deprecated_string)
211
225
strings.append('')
212
strings.extend(textwrap.wrap(self.__doc__))
226
strings.extend(textwrap.wrap(self.__doc__,
227
break_long_words=False))
213
228
strings.append('')
214
229
return '\n'.join(strings)
265
280
See `Using hooks`_ in the User Guide for examples.
267
.. _Using hooks: ../user-guide/index.html#using-hooks
282
.. _Using hooks: ../user-guide/hooks.html
269
284
The class that contains each hook is given before the hooks it supplies. For
270
285
instance, BranchHooks as the class is the hooks class for