/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-07-22 13:10:44 UTC
  • mfrom: (0.200.588 trunk)
  • mto: (0.200.597 trunk)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20090722131044-r30g8w06xd8f40fl
merge trunk.

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, 1, 'final', 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
    )
 
63
from bzrlib.version_info_formats.format_rio import (
 
64
    RioVersionInfoBuilder,
 
65
    )
65
66
from bzrlib.send import (
66
67
    format_registry as send_format_registry,
67
68
    )
68
 
from bzrlib.version_info_formats.format_rio import (
69
 
    RioVersionInfoBuilder,
70
 
    )
71
69
 
72
70
 
73
71
if getattr(sys, "frozen", None):
85
83
    except ImportError:
86
84
        raise ImportError("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 ImportError("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",
104
102
    def is_supported(self):
105
103
        return True
106
104
 
 
105
    def network_name(self):
 
106
        return "git"
 
107
 
107
108
 
108
109
class LocalGitBzrDirFormat(GitBzrDirFormat):
109
110
    """The .git directory control format."""
116
117
        """Open this directory.
117
118
 
118
119
        """
119
 
        import dulwich as git
 
120
        import dulwich
120
121
        # we dont grok readonly - git isn't integrated with transport.
121
122
        url = transport.base
122
123
        if url.startswith('readonly+'):
123
124
            url = url[len('readonly+'):]
124
125
 
125
126
        try:
126
 
            gitrepo = git.repo.Repo(transport.local_abspath(".").encode(osutils._fs_enc))
 
127
            gitrepo = dulwich.repo.Repo(transport.local_abspath(".").encode(osutils._fs_enc))
127
128
        except bzr_errors.NotLocalUrl:
128
129
            raise bzr_errors.NotBranchError(path=transport.base)
129
130
        from bzrlib.plugins.git.dir import LocalGitDir, GitLockableFiles, GitLock
143
144
        if not transport.has(".git") and not transport.has("objects"):
144
145
            raise bzr_errors.NotBranchError(path=transport.base)
145
146
 
146
 
        import dulwich as git
 
147
        import dulwich
147
148
        format = klass()
148
149
        try:
149
150
            format.open(transport)
150
151
            return format
151
 
        except git.errors.NotGitRepository, e:
 
152
        except dulwich.errors.NotGitRepository, e:
152
153
            raise bzr_errors.NotBranchError(path=transport.base)
153
154
        raise bzr_errors.NotBranchError(path=transport.base)
154
155
 
241
242
foreign_vcs_registry.register_lazy("git", 
242
243
    "bzrlib.plugins.git.mapping", "foreign_git", "Stupid content tracker")
243
244
 
244
 
plugin_cmds.register_lazy("cmd_git_serve", [], "bzrlib.plugins.git.commands")
245
245
plugin_cmds.register_lazy("cmd_git_import", [], "bzrlib.plugins.git.commands")
246
246
plugin_cmds.register_lazy("cmd_git_object", ["git-objects", "git-cat"], 
247
247
    "bzrlib.plugins.git.commands")
256
256
if rio_hooks is not None:
257
257
    rio_hooks.install_named_hook('revision', update_stanza, None)
258
258
 
 
259
 
 
260
try:
 
261
    from bzrlib.transport import transport_server_registry
 
262
except ImportError:
 
263
    pass
 
264
else:
 
265
    transport_server_registry.register_lazy('git',
 
266
        'bzrlib.plugins.git.server', 
 
267
        'serve_git',
 
268
        'Git Smart server protocol over TCP. (default port: 9418)')
 
269
 
 
270
 
 
271
from bzrlib.repository import network_format_registry as repository_network_format_registry
 
272
repository_network_format_registry.register_lazy('git', 
 
273
    'bzrlib.plugins.git.repository', 'GitRepositoryFormat')
 
274
 
 
275
from bzrlib.bzrdir import network_format_registry as bzrdir_network_format_registry
 
276
bzrdir_network_format_registry.register('git', GitBzrDirFormat)
 
277
 
 
278
 
259
279
def get_rich_root_format(stacked=False):
260
280
    if stacked:
261
281
        return bzrdir.format_registry.make_bzrdir("1.9-rich-root")