/breezy-hg/trunk

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy-hg/trunk

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Jelmer Vernooij
  • Date: 2012-03-29 13:18:05 UTC
  • mfrom: (544.1.1 register-lazy)
  • Revision ID: jelmer@samba.org-20120329131805-8n3n0eda7m9cxvme
Use lazy registries if possible.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
    errors,
47
47
    trace,
48
48
    )
49
 
from bzrlib.foreign import (
50
 
    foreign_vcs_registry,
51
 
    )
52
 
from bzrlib.send import (
53
 
    format_registry as send_format_registry,
54
 
    )
55
 
 
56
49
from bzrlib.controldir import (
57
50
    network_format_registry as controldir_network_format_registry,
58
51
    ControlDirFormat,
81
74
    trace.mutter("bzr-hg: using Mercurial %s" % hg_version)
82
75
 
83
76
 
84
 
foreign_vcs_registry.register_lazy("hg",
85
 
    "bzrlib.plugins.hg.mapping", "foreign_hg", "Mercurial")
 
77
try:
 
78
    from bzrlib.registry import register_lazy
 
79
except ImportError:
 
80
    from bzrlib.foreign import (
 
81
        foreign_vcs_registry,
 
82
        )
 
83
    foreign_vcs_registry.register_lazy("hg",
 
84
        "bzrlib.plugins.hg.mapping", "foreign_hg", "Mercurial")
 
85
    from bzrlib.send import (
 
86
        format_registry as send_format_registry,
 
87
        )
 
88
    send_format_registry.register_lazy('hg', 'bzrlib.plugins.hg.send',
 
89
                                       'send_hg', 'Mecurial bundle format')
 
90
else:
 
91
    register_lazy("bzrlib.foreign", "foreign_vcs_registry", "hg",
 
92
        "bzrlib.plugins.hg.mapping", "foreign_hg", "Mercurial")
 
93
    register_lazy("bzrlib.send", "format_registry", 'hg',
 
94
            'bzrlib.plugins.hg.send', 'send_hg', 'Mecurial bundle format')
86
95
 
87
96
def has_hg_http_smart_server(transport, external_url):
88
97
    """Check if there is a Mercurial smart server at the remote location.
225
234
repository_format_registry.register_extra_lazy('bzrlib.plugins.hg.repository',
226
235
        'HgRepositoryFormat')
227
236
 
228
 
send_format_registry.register_lazy('hg', 'bzrlib.plugins.hg.send',
229
 
                                   'send_hg', 'Mecurial bundle format')
230
 
 
231
237
from bzrlib.revisionspec import revspec_registry
232
238
revspec_registry.register_lazy("hg:", "bzrlib.plugins.hg.revspec",
233
239
    "RevisionSpec_hg")