Merge lp:~jelmer/bzr-loom/register-lazy into lp:bzr-loom

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: 159
Merged at revision: 159
Proposed branch: lp:~jelmer/bzr-loom/register-lazy
Merge into: lp:bzr-loom
Diff against target: 29 lines (+13/-6)
1 file modified
__init__.py (+13/-6)
To merge this branch: bzr merge lp:~jelmer/bzr-loom/register-lazy
Reviewer Review Type Date Requested Status
Loom Developers Pending
Review via email: mp+99934@code.launchpad.net

Description of the change

Use lazy registries if supported (introduced in bzr 2.6)

To post a comment you must log in.

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-16 17:15:22 +0000
3+++ __init__.py 2012-03-29 13:17:29 +0000
4@@ -115,12 +115,19 @@
5 install_lazy_named_hook('bzrlib.status', 'hooks', 'post_status',
6 show_loom_summary, 'loom status')
7
8-from bzrlib.revisionspec import revspec_registry
9-revspec_registry.register_lazy('thread:', 'bzrlib.plugins.loom.revspec',
10- 'RevisionSpecThread')
11-revspec_registry.register_lazy('below:', 'bzrlib.plugins.loom.revspec',
12- 'RevisionSpecBelow')
13-
14+try:
15+ from bzrlib.registry import register_lazy
16+except ImportError: # bzr < 2.6
17+ from bzrlib.revisionspec import revspec_registry
18+ revspec_registry.register_lazy('thread:', 'bzrlib.plugins.loom.revspec',
19+ 'RevisionSpecThread')
20+ revspec_registry.register_lazy('below:', 'bzrlib.plugins.loom.revspec',
21+ 'RevisionSpecBelow')
22+else:
23+ register_lazy("bzrlib.revisionspec", "revspec_registry", 'thread:',
24+ 'bzrlib.plugins.loom.revspec', 'RevisionSpecThread')
25+ register_lazy("bzrlib.revisionspec", "revspec_registry", 'below:',
26+ 'bzrlib.plugins.loom.revspec', 'RevisionSpecBelow')
27
28 _LOOM_FORMATS = {
29 "Bazaar-NG Loom branch format 1\n": "BzrBranchLoomFormat1",

Subscribers

People subscribed via source and target branches