Merge lp:~jelmer/bzr-search/lazy-commands into lp:bzr-search

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: 91
Merged at revision: 92
Proposed branch: lp:~jelmer/bzr-search/lazy-commands
Merge into: lp:bzr-search
Diff against target: 36 lines (+4/-5)
1 file modified
__init__.py (+4/-5)
To merge this branch: bzr merge lp:~jelmer/bzr-search/lazy-commands
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Review via email: mp+83321@code.launchpad.net

Description of the change

Use lazy registration for the 'bzr index' and 'bzr search' commands.

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

Yeah for registries and lazy loading ;-P

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 2011-11-23 20:51:29 +0000
3+++ __init__.py 2011-11-24 16:26:25 +0000
4@@ -30,13 +30,10 @@
5 See `bzr help search` or `bzr help plugins/search`.
6 """
7
8-import bzrlib.commands
9-
10 # Relative because at __init__ time the module does not exist.
11 from bzrlib.branch import Branch
12 from bzrlib import log
13-import commands
14-import errors
15+from bzrlib.commands import plugin_cmds
16 import index
17 from bzrlib.smart.request import request_handlers as smart_request_handlers
18
19@@ -45,7 +42,8 @@
20 'index',
21 'search',
22 ]:
23- bzrlib.commands.register_command(getattr(commands, 'cmd_' + command))
24+ plugin_cmds.register_lazy("cmd_" + command, [],
25+ "bzrlib.plugins.search.commands")
26
27
28 version_info = (1, 7, 0, 'dev', 0)
29@@ -53,6 +51,7 @@
30
31 def auto_index_branch(result):
32 """Handled for the post_change_branch_tip hook to update a search index."""
33+ from bzrlib.plugins.search import errors
34 try:
35 search_index = index.open_index_branch(result.branch)
36 except errors.NoSearchIndex:

Subscribers

People subscribed via source and target branches

to all changes: