Merge lp:~jelmer/bzr-upload/install-lazy-named-hook into lp:bzr-upload

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: 94
Merge reported by: Vincent Ladeuil
Merged at revision: not available
Proposed branch: lp:~jelmer/bzr-upload/install-lazy-named-hook
Merge into: lp:bzr-upload
Diff against target: 41 lines (+8/-5)
1 file modified
__init__.py (+8/-5)
To merge this branch: bzr merge lp:~jelmer/bzr-upload/install-lazy-named-hook
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Review via email: mp+97942@code.launchpad.net

Description of the change

Use install_lazy_named_hook.

This gets us another small step towards not having to load bzrlib.branch.

To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

Merged :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '__init__.py'
2--- __init__.py 2012-03-15 20:53:45 +0000
3+++ __init__.py 2012-03-16 17:53:18 +0000
4@@ -141,6 +141,8 @@
5
6 """
7
8+from __future__ import absolute_import
9+
10 # TODO: the chmod bits *can* be supported via the upload protocols
11 # (i.e. poorly), but since the web developers use these protocols to upload
12 # manually, it is expected that the associated web server is coherent with
13@@ -156,12 +158,13 @@
14 import bzrlib
15 from bzrlib import (
16 api,
17- branch,
18 commands,
19 config,
20 )
21
22-from info import (
23+from bzrlib.hooks import install_lazy_named_hook
24+
25+from bzrlib.plugins.upload.info import (
26 bzr_plugin_version as version_info,
27 bzr_compatible_versions,
28 )
29@@ -223,9 +226,9 @@
30
31
32 def install_auto_upload_hook():
33- branch.Branch.hooks.install_named_hook('post_change_branch_tip',
34- auto_upload_hook,
35- 'Auto upload code from a branch when it is changed.')
36+ install_lazy_named_hook("bzrlib.branch", "Branch.hooks",
37+ 'post_change_branch_tip', auto_upload_hook,
38+ 'Auto upload code from a branch when it is changed.')
39
40
41 install_auto_upload_hook()

Subscribers

People subscribed via source and target branches

to status/vote changes: