/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: 2010-06-28 23:48:36 UTC
  • mto: (0.200.953 trunk)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20100628234836-96qxjh7g2xxedblp
Fix transportgit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
 
71
71
if getattr(sys, "frozen", None):
72
72
    # allow import additional libs from ./_lib for bzr.exe only
73
 
    sys.path.append(os.path.normpath(os.path.join(os.path.dirname(__file__), '_lib')))
 
73
    sys.path.append(os.path.normpath(
 
74
        os.path.join(os.path.dirname(__file__), '_lib')))
74
75
 
75
76
_versions_checked = False
76
77
def lazy_check_versions():
85
86
            "bzr-git: Please install dulwich, https://launchpad.net/dulwich")
86
87
    else:
87
88
        if dulwich_version < dulwich_minimum_version:
88
 
            raise bzr_errors.DependencyNotPresent("dulwich", "bzr-git: Dulwich is too old; at least %d.%d.%d is required" % dulwich_minimum_version)
 
89
            raise bzr_errors.DependencyNotPresent("dulwich",
 
90
                "bzr-git: Dulwich is too old; at least %d.%d.%d is required" %
 
91
                    dulwich_minimum_version)
89
92
 
90
93
bzrdir.format_registry.register_lazy('git',
91
94
    "bzrlib.plugins.git.dir", "LocalGitBzrDirFormat",
109
112
 
110
113
    _lock_class = TransportLock
111
114
 
 
115
    colocated_branches = True
 
116
 
112
117
    def is_supported(self):
113
118
        return True
114
119
 
128
133
 
129
134
        """
130
135
        lazy_check_versions()
131
 
        # we dont grok readonly - git isn't integrated with transport.
132
 
        from bzrlib.transport.local import LocalTransport
133
 
        if isinstance(transport, LocalTransport):
134
 
            import dulwich
135
 
            gitrepo = dulwich.repo.Repo(transport.local_abspath(".").encode(osutils._fs_enc))
136
 
        else:
137
 
            from bzrlib.plugins.git.transportgit import TransportRepo
138
 
            gitrepo = TransportRepo(transport)
 
136
        from bzrlib.plugins.git.transportgit import TransportRepo
 
137
        gitrepo = TransportRepo(transport)
139
138
        from bzrlib.plugins.git.dir import LocalGitDir, GitLockableFiles, GitLock
140
139
        lockfiles = GitLockableFiles(transport, GitLock())
141
140
        return LocalGitDir(transport, lockfiles, gitrepo, self)
143
142
    @classmethod
144
143
    def probe_transport(klass, transport):
145
144
        try:
146
 
            if not (transport.has('info/refs') or 
147
 
                    transport.has('.git/branches') or 
148
 
                    transport.has('branches')):
 
145
            if not transport.has_any(['info/refs', '.git/branches',
 
146
                                      'branches']):
149
147
                raise bzr_errors.NotBranchError(path=transport.base)
150
148
        except bzr_errors.NoSuchFile:
151
149
            raise bzr_errors.NotBranchError(path=transport.base)
252
250
plugin_cmds.register_lazy("cmd_git_import", [], "bzrlib.plugins.git.commands")
253
251
plugin_cmds.register_lazy("cmd_git_object", ["git-objects", "git-cat"],
254
252
    "bzrlib.plugins.git.commands")
 
253
plugin_cmds.register_lazy("cmd_git_refs", [], "bzrlib.plugins.git.commands")
 
254
plugin_cmds.register_lazy("cmd_git_apply", [], "bzrlib.plugins.git.commands")
255
255
 
256
256
def update_stanza(rev, stanza):
257
257
    mapping = getattr(rev, "mapping", None)
271
271
    'Git Smart server protocol over TCP. (default port: 9418)')
272
272
 
273
273
 
274
 
from bzrlib.repository import network_format_registry as repository_network_format_registry
 
274
from bzrlib.repository import (
 
275
    network_format_registry as repository_network_format_registry,
 
276
    )
275
277
repository_network_format_registry.register_lazy('git',
276
278
    'bzrlib.plugins.git.repository', 'GitRepositoryFormat')
277
279
 
278
 
from bzrlib.bzrdir import network_format_registry as bzrdir_network_format_registry
 
280
from bzrlib.bzrdir import (
 
281
    network_format_registry as bzrdir_network_format_registry,
 
282
    )
279
283
bzrdir_network_format_registry.register('git', GitBzrDirFormat)
280
284
 
281
 
 
282
 
def get_rich_root_format(stacked=False):
283
 
    if stacked:
284
 
        return bzrdir.format_registry.make_bzrdir("1.9-rich-root")
285
 
    else:
286
 
        return bzrdir.format_registry.make_bzrdir("default-rich-root")
287
 
 
288
285
send_format_registry.register_lazy('git', 'bzrlib.plugins.git.send',
289
286
                                   'send_git', 'Git am-style diff format')
290
287
 
 
288
try:
 
289
    from bzrlib.diff import format_registry as diff_format_registry
 
290
except ImportError:
 
291
    pass
 
292
else:
 
293
    diff_format_registry.register_lazy('git', 'bzrlib.plugins.git.send',
 
294
        'GitDiffTree', 'Git am-style diff format')
 
295
 
291
296
def test_suite():
292
297
    from bzrlib.plugins.git import tests
293
298
    return tests.test_suite()