/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

Fix formatting, remove catch-all for exceptions when opening local repositories.

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
        if stacked:
 
79
            return bzrlib.bzrdir.format_registry.make_bzrdir("pack-0.92")
 
80
        else:
 
81
            return bzrlib.bzrdir.format_registry.make_bzrdir("1.6")
 
82
 
77
83
 
78
84
class LocalGitDir(GitDir):
79
85
    """An adapter to the '.git' dir used by git."""
117
123
            return workingtree.GitWorkingTree(self, self.open_repository(), 
118
124
                                                  self.open_branch())
119
125
 
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
 
 
126
126
    def create_repository(self, shared=False):
127
127
        return self.open_repository()
128
128
 
129
129
 
130
 
class LocalGitBzrDirFormat(bzrdir.BzrDirFormat):
 
130
class GitBzrDirFormat(bzrdir.BzrDirFormat):
 
131
    _lock_class = TransportLock
 
132
 
 
133
    def is_supported(self):
 
134
        return True
 
135
 
 
136
 
 
137
class LocalGitBzrDirFormat(GitBzrDirFormat):
131
138
    """The .git directory control format."""
132
139
 
133
140
    _gitdir_class = LocalGitDir
134
 
    _lock_class = TransportLock
135
141
 
136
142
    @classmethod
137
143
    def _known_formats(self):
157
163
    @classmethod
158
164
    def probe_transport(klass, transport):
159
165
        """Our format is present if the transport ends in '.not/'."""
 
166
        from bzrlib.plugins.git import git
160
167
        # little ugly, but works
161
168
        format = klass()
162
169
        # delegate to the main opening code. This pays a double rtt cost at the
166
173
        try:
167
174
            format.open(transport)
168
175
            return format
169
 
        except Exception, e:
 
176
        except git.errors.NotGitRepository, e:
170
177
            raise errors.bzr_errors.NotBranchError(path=transport.base)
171
178
        raise errors.bzr_errors.NotBranchError(path=transport.base)
172
179
 
192
199
        return True
193
200
 
194
201
 
195
 
class RemoteGitBzrDirFormat(bzrdir.BzrDirFormat):
 
202
class RemoteGitBzrDirFormat(GitBzrDirFormat):
196
203
    """The .git directory control format."""
197
204
 
198
 
    _lock_class = TransportLock
199
 
 
200
205
    @classmethod
201
206
    def _known_formats(self):
202
207
        return set([RemoteGitBzrDirFormat()])
244
249
    def initialize_on_transport(self, transport):
245
250
        raise errors.bzr_errors.UninitializableFormat(self)
246
251
 
247
 
    def is_supported(self):
248
 
        return True