~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/hooks.py

  • Committer: Robert Collins
  • Date: 2010-05-06 23:41:35 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506234135-yivbzczw1sejxnxc
Lock methods on ``Tree``, ``Branch`` and ``Repository`` are now
expected to return an object which can be used to unlock them. This reduces
duplicate code when using cleanups. The previous 'tokens's returned by
``Branch.lock_write`` and ``Repository.lock_write`` are now attributes
on the result of the lock_write. ``repository.RepositoryWriteLockResult``
and ``branch.BranchWriteLockResult`` document this. (Robert Collins)

``log._get_info_for_log_files`` now takes an add_cleanup callable.
(Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007, 2008 Canonical Ltd
 
1
# Copyright (C) 2007-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
"""Support for plugin hooking logic."""
19
19
from bzrlib import registry
20
20
from bzrlib.lazy_import import lazy_import
21
 
from bzrlib.symbol_versioning import deprecated_method
22
21
lazy_import(globals(), """
23
22
import textwrap
24
23
 
45
44
    'bzrlib.info', 'InfoHooks')
46
45
known_hooks.register_lazy(('bzrlib.lock', 'Lock.hooks'), 'bzrlib.lock',
47
46
    'LockHooks')
 
47
known_hooks.register_lazy(('bzrlib.merge', 'Merger.hooks'), 'bzrlib.merge',
 
48
    'MergeHooks')
48
49
known_hooks.register_lazy(('bzrlib.msgeditor', 'hooks'), 'bzrlib.msgeditor',
49
50
    'MessageEditorHooks')
50
51
known_hooks.register_lazy(('bzrlib.mutabletree', 'MutableTree.hooks'),
57
58
    ('bzrlib.version_info_formats.format_rio', 'RioVersionInfoBuilder.hooks'),
58
59
    'bzrlib.version_info_formats.format_rio', 'RioVersionInfoBuilderHooks')
59
60
known_hooks.register_lazy(
60
 
    ('bzrlib.merge_directive', '_BaseMergeDirective.hooks'),
 
61
    ('bzrlib.merge_directive', 'BaseMergeDirective.hooks'),
61
62
    'bzrlib.merge_directive', 'MergeDirectiveHooks')
62
63
 
63
64
 
219
220
        strings.append('Introduced in: %s' % introduced_string)
220
221
        if self.deprecated:
221
222
            deprecated_string = _format_version_tuple(self.deprecated)
222
 
        else:
223
 
            deprecated_string = 'Not deprecated'
224
 
        strings.append('Deprecated in: %s' % deprecated_string)
 
223
            strings.append('Deprecated in: %s' % deprecated_string)
225
224
        strings.append('')
226
225
        strings.extend(textwrap.wrap(self.__doc__,
227
226
            break_long_words=False))
279
278
 
280
279
See `Using hooks`_ in the User Guide for examples.
281
280
 
282
 
.. _Using hooks: ../user-guide/index.html#using-hooks
 
281
.. _Using hooks: ../user-guide/hooks.html
283
282
 
284
283
The class that contains each hook is given before the hooks it supplies. For
285
284
instance, BranchHooks as the class is the hooks class for