/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:
75
75
        return True
76
76
 
77
77
    def cloning_metadir(self, stacked=False):
78
 
        return bzrlib.bzrdir.format_registry.make_bzrdir("1.9-rich-root")
 
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")
79
82
 
80
83
 
81
84
class LocalGitDir(GitDir):
113
116
        return self._gitrepository_class(self, self._lockfiles)
114
117
 
115
118
    def open_workingtree(self, recommend_upgrade=True):
116
 
        if (not self._git.bare and 
117
 
            os.path.exists(os.path.join(self._git.controldir(), "index"))):
 
119
        if self._git.bare:
 
120
            loc = urlutils.unescape_for_display(self.root_transport.base, 'ascii')
 
121
            raise errors.bzr_errors.NoWorkingTree(loc)
 
122
        else:
118
123
            return workingtree.GitWorkingTree(self, self.open_repository(), 
119
124
                                                  self.open_branch())
120
 
        loc = urlutils.unescape_for_display(self.root_transport.base, 'ascii')
121
 
        raise errors.bzr_errors.NoWorkingTree(loc)
122
125
 
123
126
    def create_repository(self, shared=False):
124
127
        return self.open_repository()
144
147
        """Open this directory.
145
148
 
146
149
        """
147
 
        import dulwich as git
 
150
        from bzrlib.plugins.git import git
148
151
        # we dont grok readonly - git isn't integrated with transport.
149
152
        url = transport.base
150
153
        if url.startswith('readonly+'):
160
163
    @classmethod
161
164
    def probe_transport(klass, transport):
162
165
        """Our format is present if the transport ends in '.not/'."""
163
 
        import dulwich as git
 
166
        from bzrlib.plugins.git import git
164
167
        # little ugly, but works
165
168
        format = klass()
166
169
        # delegate to the main opening code. This pays a double rtt cost at the
182
185
 
183
186
    def initialize_on_transport(self, transport):
184
187
        from bzrlib.transport.local import LocalTransport
185
 
        import dulwich as git
 
188
        from bzrlib.plugins.git import git
186
189
 
187
190
        if not isinstance(transport, LocalTransport):
188
191
            raise NotImplementedError(self.initialize, 
231
234
        try:
232
235
            transport.fetch_pack(lambda x: [], None, lambda x: None, 
233
236
                                 lambda x: mutter("git: %s" % x))
234
 
        except errors.git_errors.GitProtocolError:
 
237
        except GitProtocolException, e:
235
238
            raise errors.bzr_errors.NotBranchError(path=transport.base)
236
239
        else:
237
240
            return format