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
=== modified file '__init__.py'
--- __init__.py 2011-11-23 20:51:29 +0000
+++ __init__.py 2011-11-24 16:26:25 +0000
@@ -30,13 +30,10 @@
30See `bzr help search` or `bzr help plugins/search`.30See `bzr help search` or `bzr help plugins/search`.
31"""31"""
3232
33import bzrlib.commands
34
35# Relative because at __init__ time the module does not exist.33# Relative because at __init__ time the module does not exist.
36from bzrlib.branch import Branch34from bzrlib.branch import Branch
37from bzrlib import log35from bzrlib import log
38import commands36from bzrlib.commands import plugin_cmds
39import errors
40import index37import index
41from bzrlib.smart.request import request_handlers as smart_request_handlers38from bzrlib.smart.request import request_handlers as smart_request_handlers
4239
@@ -45,7 +42,8 @@
45 'index',42 'index',
46 'search',43 'search',
47 ]:44 ]:
48 bzrlib.commands.register_command(getattr(commands, 'cmd_' + command))45 plugin_cmds.register_lazy("cmd_" + command, [],
46 "bzrlib.plugins.search.commands")
4947
5048
51version_info = (1, 7, 0, 'dev', 0)49version_info = (1, 7, 0, 'dev', 0)
@@ -53,6 +51,7 @@
5351
54def auto_index_branch(result):52def auto_index_branch(result):
55 """Handled for the post_change_branch_tip hook to update a search index."""53 """Handled for the post_change_branch_tip hook to update a search index."""
54 from bzrlib.plugins.search import errors
56 try:55 try:
57 search_index = index.open_index_branch(result.branch)56 search_index = index.open_index_branch(result.branch)
58 except errors.NoSearchIndex:57 except errors.NoSearchIndex:

Subscribers

People subscribed via source and target branches

to all changes: