/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Jelmer Vernooij
  • Date: 2009-09-10 13:13:15 UTC
  • mto: (0.200.602 trunk)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20090910131315-6890xg58pl2jseml
Allow serving remote URLs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
import bzrlib
28
28
import bzrlib.api
29
29
 
30
 
# versions ending in 'exp' mean experimental mappings
31
 
# versions ending in 'dev' mean development version
32
 
# versions ending in 'final' mean release (well tested, etc)
33
 
version_info = (0, 3, 3, 'dev', 0)
 
30
from info import (
 
31
    bzr_compatible_versions,
 
32
    bzr_plugin_version as version_info,
 
33
    dulwich_minimum_version,
 
34
    )
34
35
 
35
36
if version_info[3] == 'final':
36
37
    version_string = '%d.%d.%d' % version_info[:3]
38
39
    version_string = '%d.%d.%d%s%d' % version_info
39
40
__version__ = version_string
40
41
 
41
 
MINIMUM_DULWICH_VERSION = (0, 3, 1)
42
 
COMPATIBLE_BZR_VERSIONS = [(1, 14, 0), (1, 15, 0)]
43
 
 
44
 
bzrlib.api.require_any_api(bzrlib, COMPATIBLE_BZR_VERSIONS)
 
42
bzrlib.api.require_any_api(bzrlib, bzr_compatible_versions)
45
43
 
46
44
 
47
45
from bzrlib import (
62
60
from bzrlib.commands import (
63
61
    plugin_cmds,
64
62
    )
65
 
from bzrlib.trace import (
66
 
    warning,
67
 
    )
68
63
from bzrlib.version_info_formats.format_rio import (
69
64
    RioVersionInfoBuilder,
70
65
    )
 
66
from bzrlib.send import (
 
67
    format_registry as send_format_registry,
 
68
    )
71
69
 
72
70
 
73
71
if getattr(sys, "frozen", None):
83
81
    try:
84
82
        from dulwich import __version__ as dulwich_version
85
83
    except ImportError:
86
 
        raise ImportError("bzr-git: Please install dulwich, https://launchpad.net/dulwich")
 
84
        raise bzr_errors.DependencyNotPresent("dulwich", "bzr-git: Please install dulwich, https://launchpad.net/dulwich")
87
85
    else:
88
 
        if dulwich_version < MINIMUM_DULWICH_VERSION:
89
 
            raise ImportError("bzr-git: Dulwich is too old; at least %d.%d.%d is required" % MINIMUM_DULWICH_VERSION)
 
86
        if dulwich_version < dulwich_minimum_version:
 
87
            raise bzr_errors.DependencyNotPresent("dulwich", "bzr-git: Dulwich is too old; at least %d.%d.%d is required" % dulwich_minimum_version)
90
88
 
91
89
bzrdir.format_registry.register_lazy('git', 
92
90
    "bzrlib.plugins.git.dir", "LocalGitBzrDirFormat",
119
117
        """Open this directory.
120
118
 
121
119
        """
122
 
        import dulwich as git
 
120
        import dulwich
123
121
        # we dont grok readonly - git isn't integrated with transport.
124
122
        url = transport.base
125
123
        if url.startswith('readonly+'):
126
124
            url = url[len('readonly+'):]
127
125
 
128
126
        try:
129
 
            gitrepo = git.repo.Repo(transport.local_abspath(".").encode(osutils._fs_enc))
 
127
            gitrepo = dulwich.repo.Repo(transport.local_abspath(".").encode(osutils._fs_enc))
130
128
        except bzr_errors.NotLocalUrl:
131
129
            raise bzr_errors.NotBranchError(path=transport.base)
132
130
        from bzrlib.plugins.git.dir import LocalGitDir, GitLockableFiles, GitLock
146
144
        if not transport.has(".git") and not transport.has("objects"):
147
145
            raise bzr_errors.NotBranchError(path=transport.base)
148
146
 
149
 
        import dulwich as git
 
147
        import dulwich
150
148
        format = klass()
151
149
        try:
152
150
            format.open(transport)
153
151
            return format
154
 
        except git.errors.NotGitRepository, e:
 
152
        except dulwich.errors.NotGitRepository, e:
155
153
            raise bzr_errors.NotBranchError(path=transport.base)
156
154
        raise bzr_errors.NotBranchError(path=transport.base)
157
155
 
259
257
    rio_hooks.install_named_hook('revision', update_stanza, None)
260
258
 
261
259
 
262
 
try:
263
 
    from bzrlib.transport import transport_server_registry
264
 
except ImportError:
265
 
    pass
266
 
else:
267
 
    transport_server_registry.register_lazy('git',
268
 
        'bzrlib.plugins.git.server', 
269
 
        'serve_git',
270
 
        'Git Smart server protocol over TCP. (default port: 9418)')
 
260
from bzrlib.transport import transport_server_registry
 
261
transport_server_registry.register_lazy('git',
 
262
    'bzrlib.plugins.git.server', 
 
263
    'serve_git',
 
264
    'Git Smart server protocol over TCP. (default port: 9418)')
271
265
 
272
266
 
273
267
from bzrlib.repository import network_format_registry as repository_network_format_registry
284
278
    else:
285
279
        return bzrdir.format_registry.make_bzrdir("default-rich-root")
286
280
 
 
281
send_format_registry.register_lazy('git', 'bzrlib.plugins.git.send',
 
282
                                   'send_git', 'Git am-style diff format')
 
283
 
287
284
def test_suite():
288
285
    from bzrlib.plugins.git import tests
289
286
    return tests.test_suite()