/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 git_dir.py

Ignore .plugins dir.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""An adapter between a Git control dir and a Bazaar BzrDir"""
18
18
 
19
 
import git, os
 
19
import git
20
20
 
21
 
import bzrlib
22
21
from bzrlib.lazy_import import lazy_import
23
22
from bzrlib import (
24
23
    bzrdir,
27
26
    )
28
27
 
29
28
lazy_import(globals(), """
30
 
from bzrlib.lockable_files import TransportLock
31
29
from bzrlib.plugins.git import (
32
30
    errors,
33
 
    branch,
34
 
    repository,
35
 
    workingtree,
 
31
    git_branch,
 
32
    git_repository,
 
33
    git_workingtree,
36
34
    )
37
35
""")
38
36
 
66
64
class GitDir(bzrdir.BzrDir):
67
65
    """An adapter to the '.git' dir used by git."""
68
66
 
69
 
    _gitrepository_class = repository.GitRepository
 
67
    _gitrepository_class = git_repository.GitRepository
70
68
 
71
69
    def __init__(self, transport, lockfiles, gitrepo, format):
72
70
        self._format = format
98
96
            head = None
99
97
        else:
100
98
            head = repo._git.heads[0].commit.id
101
 
        return branch.GitBranch(self, repo, head, 
 
99
        return git_branch.GitBranch(self, repo, head, 
102
100
                                    self.root_transport.base, self._lockfiles)
103
101
 
104
102
    def open_repository(self, shared=False):
110
108
            loc = urlutils.unescape_for_display(self.root_transport.base, 'ascii')
111
109
            raise errors.bzr_errors.NoWorkingTree(loc)
112
110
        else:
113
 
            return workingtree.GitWorkingTree(self, self.open_repository(), 
 
111
            return git_workingtree.GitWorkingTree(self, self.open_repository(), 
114
112
                                                  self.open_branch())
115
113
 
116
 
    def cloning_metadir(self, stacked=False):
117
 
        if stacked:
118
 
            return bzrlib.bzrdir.format_registry.make_bzrdir("pack-0.92")
119
 
        else:
120
 
            return bzrlib.bzrdir.format_registry.make_bzrdir("1.6")
121
 
 
122
 
    def create_repository(self, shared=False):
123
 
        return self.open_repository()
 
114
    def cloning_metadir(self):
 
115
        return bzrdir.BzrDirFormat.get_default_format()
124
116
 
125
117
 
126
118
class GitBzrDirFormat(bzrdir.BzrDirFormat):
127
119
    """The .git directory control format."""
128
120
 
129
121
    _gitdir_class = GitDir
130
 
    _lock_class = TransportLock
131
122
 
132
123
    @classmethod
133
124
    def _known_formats(self):
168
159
    def get_format_description(self):
169
160
        return "Local Git Repository"
170
161
 
171
 
    def get_format_string(self):
172
 
        return "Local Git Repository"
173
 
 
174
 
    def initialize_on_transport(self, transport):
175
 
        from bzrlib.transport.local import LocalTransport
176
 
 
177
 
        if not isinstance(transport, LocalTransport):
178
 
            raise NotImplementedError(self.initialize, 
179
 
                "Can't create Git Repositories/branches on "
180
 
                "non-local transports")
181
 
 
182
 
        git.repo.Repo.create(transport.local_abspath(".")) 
183
 
        return self.open(transport)
184
 
 
185
162
 
186
163
bzrdir.BzrDirFormat.register_control_format(GitBzrDirFormat)