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

Share more infrastructure between LocalGitDir and RemoteGitDir.

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
    def is_supported(self):
75
75
        return True
76
76
 
77
 
    def cloning_metadir(self, stacked=False):
78
 
        return bzrlib.bzrdir.format_registry.make_bzrdir("1.9-rich-root")
79
 
 
80
77
 
81
78
class LocalGitDir(GitDir):
82
79
    """An adapter to the '.git' dir used by git."""
120
117
            return workingtree.GitWorkingTree(self, self.open_repository(), 
121
118
                                                  self.open_branch())
122
119
 
 
120
    def cloning_metadir(self, stacked=False):
 
121
        if stacked:
 
122
            return bzrlib.bzrdir.format_registry.make_bzrdir("pack-0.92")
 
123
        else:
 
124
            return bzrlib.bzrdir.format_registry.make_bzrdir("1.6")
 
125
 
123
126
    def create_repository(self, shared=False):
124
127
        return self.open_repository()
125
128
 
126
129
 
127
 
class GitBzrDirFormat(bzrdir.BzrDirFormat):
128
 
    _lock_class = TransportLock
129
 
 
130
 
    def is_supported(self):
131
 
        return True
132
 
 
133
 
 
134
 
class LocalGitBzrDirFormat(GitBzrDirFormat):
 
130
class LocalGitBzrDirFormat(bzrdir.BzrDirFormat):
135
131
    """The .git directory control format."""
136
132
 
137
133
    _gitdir_class = LocalGitDir
 
134
    _lock_class = TransportLock
138
135
 
139
136
    @classmethod
140
137
    def _known_formats(self):
160
157
    @classmethod
161
158
    def probe_transport(klass, transport):
162
159
        """Our format is present if the transport ends in '.not/'."""
163
 
        from bzrlib.plugins.git import git
164
160
        # little ugly, but works
165
161
        format = klass()
166
162
        # delegate to the main opening code. This pays a double rtt cost at the
170
166
        try:
171
167
            format.open(transport)
172
168
            return format
173
 
        except git.errors.NotGitRepository, e:
 
169
        except Exception, e:
174
170
            raise errors.bzr_errors.NotBranchError(path=transport.base)
175
171
        raise errors.bzr_errors.NotBranchError(path=transport.base)
176
172
 
196
192
        return True
197
193
 
198
194
 
199
 
class RemoteGitBzrDirFormat(GitBzrDirFormat):
 
195
class RemoteGitBzrDirFormat(bzrdir.BzrDirFormat):
200
196
    """The .git directory control format."""
201
197
 
 
198
    _lock_class = TransportLock
 
199
 
202
200
    @classmethod
203
201
    def _known_formats(self):
204
202
        return set([RemoteGitBzrDirFormat()])
231
229
        try:
232
230
            transport.fetch_pack(lambda x: [], None, lambda x: None, 
233
231
                                 lambda x: mutter("git: %s" % x))
234
 
        except errors.git_errors.GitProtocolError:
 
232
        except GitProtocolException, e:
235
233
            raise errors.bzr_errors.NotBranchError(path=transport.base)
236
234
        else:
237
235
            return format
246
244
    def initialize_on_transport(self, transport):
247
245
        raise errors.bzr_errors.UninitializableFormat(self)
248
246
 
 
247
    def is_supported(self):
 
248
        return True