74
74
def is_supported(self):
77
def cloning_metadir(self, stacked=False):
78
return bzrlib.bzrdir.format_registry.make_bzrdir("1.9-rich-root")
81
78
class LocalGitDir(GitDir):
82
79
"""An adapter to the '.git' dir used by git."""
113
110
return self._gitrepository_class(self, self._lockfiles)
115
112
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"))):
114
loc = urlutils.unescape_for_display(self.root_transport.base, 'ascii')
115
raise errors.bzr_errors.NoWorkingTree(loc)
118
117
return workingtree.GitWorkingTree(self, self.open_repository(),
119
118
self.open_branch())
120
loc = urlutils.unescape_for_display(self.root_transport.base, 'ascii')
121
raise errors.bzr_errors.NoWorkingTree(loc)
120
def cloning_metadir(self, stacked=False):
122
return bzrlib.bzrdir.format_registry.make_bzrdir("pack-0.92")
124
return bzrlib.bzrdir.format_registry.make_bzrdir("1.6")
123
126
def create_repository(self, shared=False):
124
127
return self.open_repository()
127
class GitBzrDirFormat(bzrdir.BzrDirFormat):
128
_lock_class = TransportLock
130
def is_supported(self):
134
class LocalGitBzrDirFormat(GitBzrDirFormat):
130
class LocalGitBzrDirFormat(bzrdir.BzrDirFormat):
135
131
"""The .git directory control format."""
137
133
_gitdir_class = LocalGitDir
134
_lock_class = TransportLock
140
137
def _known_formats(self):
183
179
def initialize_on_transport(self, transport):
184
180
from bzrlib.transport.local import LocalTransport
185
import dulwich as git
181
from bzrlib.plugins.git import git
187
183
if not isinstance(transport, LocalTransport):
188
184
raise NotImplementedError(self.initialize,
199
class RemoteGitBzrDirFormat(GitBzrDirFormat):
195
class RemoteGitBzrDirFormat(bzrdir.BzrDirFormat):
200
196
"""The .git directory control format."""
198
_lock_class = TransportLock
203
201
def _known_formats(self):
204
202
return set([RemoteGitBzrDirFormat()])
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)