105
105
def probe_transport(self, transport):
107
107
external_url = transport.external_url()
108
except bzr_errors.InProcessTransport:
109
raise bzr_errors.NotBranchError(path=transport.base)
108
except brz_errors.InProcessTransport:
109
raise brz_errors.NotBranchError(path=transport.base)
110
110
if (external_url.startswith("http:") or
111
111
external_url.startswith("https:")):
112
112
# Already handled by RemoteGitProber
113
raise bzr_errors.NotBranchError(path=transport.base)
113
raise brz_errors.NotBranchError(path=transport.base)
114
114
from .. import urlutils
115
115
if urlutils.split(transport.base)[1] == ".git":
116
raise bzr_errors.NotBranchError(path=transport.base)
116
raise brz_errors.NotBranchError(path=transport.base)
117
117
if not transport.has_any(['objects', '.git/objects', '.git']):
118
raise bzr_errors.NotBranchError(path=transport.base)
118
raise brz_errors.NotBranchError(path=transport.base)
119
119
lazy_check_versions()
120
120
from .dir import (
121
121
BareLocalGitControlDirFormat,
159
159
req.add_header("User-Agent", user_agent_for_github())
160
160
elif host == "bazaar.launchpad.net":
161
161
# Don't attempt Git probes against bazaar.launchpad.net; pad.lv/1744830
162
raise bzr_errors.NotBranchError(transport.base)
162
raise brz_errors.NotBranchError(transport.base)
163
163
resp = transport._perform(req)
164
164
if resp.code in (404, 405):
165
raise bzr_errors.NotBranchError(transport.base)
165
raise brz_errors.NotBranchError(transport.base)
166
166
headers = resp.headers
167
167
ct = headers.get("Content-Type")
169
raise bzr_errors.NotBranchError(transport.base)
169
raise brz_errors.NotBranchError(transport.base)
170
170
if ct.startswith("application/x-git"):
171
171
from .remote import RemoteGitControlDirFormat
172
172
return RemoteGitControlDirFormat()
243
243
if rev.mapping.vcs == foreign_vcs_git:
244
244
return foreign_revid
246
raise bzr_errors.InvalidRevisionId(rev.revision_id, None)
246
raise brz_errors.InvalidRevisionId(rev.revision_id, None)
249
249
def update_stanza(rev, stanza):
250
250
mapping = getattr(rev, "mapping", None)
252
252
git_commit = extract_git_foreign_revid(rev)
253
except bzr_errors.InvalidRevisionId:
253
except brz_errors.InvalidRevisionId:
256
256
stanza.add("git-commit", git_commit)
319
319
__name__ + ".dir", "GitControlDirFormat")
323
from ..registry import register_lazy
325
from ..diff import format_registry as diff_format_registry
326
diff_format_registry.register_lazy('git', __name__ + '.send',
327
'GitDiffTree', 'Git am-style diff format')
330
format_registry as send_format_registry,
332
send_format_registry.register_lazy('git', __name__ + '.send',
333
'send_git', 'Git am-style diff format')
335
from ..directory_service import directories
336
directories.register_lazy('github:', __name__ + '.directory',
339
directories.register_lazy('git@github.com:', __name__ + '.directory',
343
from ..help_topics import (
346
topic_registry.register_lazy('git', __name__ + '.help', 'help_git',
347
'Using Bazaar with Git')
349
from ..foreign import (
350
foreign_vcs_registry,
352
foreign_vcs_registry.register_lazy("git",
353
__name__ + ".mapping", "foreign_vcs_git", "Stupid content tracker")
355
register_lazy("breezy.diff", "format_registry",
356
'git', __name__ + '.send', 'GitDiffTree',
357
'Git am-style diff format')
358
register_lazy("breezy.send", "format_registry",
359
'git', __name__ + '.send', 'send_git',
360
'Git am-style diff format')
361
register_lazy('breezy.directory_service', 'directories', 'github:',
362
__name__ + '.directory', 'GitHubDirectory',
364
register_lazy('breezy.directory_service', 'directories',
365
'git@github.com:', __name__ + '.directory',
366
'GitHubDirectory', 'GitHub directory.')
367
register_lazy('breezy.help_topics', 'topic_registry',
368
'git', __name__ + '.help', 'help_git',
369
'Using Bazaar with Git')
370
register_lazy('breezy.foreign', 'foreign_vcs_registry', "git",
371
__name__ + ".mapping", "foreign_vcs_git", "Stupid content tracker")
322
from ..diff import format_registry as diff_format_registry
323
diff_format_registry.register_lazy('git', __name__ + '.send',
324
'GitDiffTree', 'Git am-style diff format')
327
format_registry as send_format_registry,
329
send_format_registry.register_lazy('git', __name__ + '.send',
330
'send_git', 'Git am-style diff format')
332
from ..directory_service import directories
333
directories.register_lazy('github:', __name__ + '.directory',
336
directories.register_lazy('git@github.com:', __name__ + '.directory',
340
from ..help_topics import (
343
topic_registry.register_lazy('git', __name__ + '.help', 'help_git',
344
'Using Bazaar with Git')
346
from ..foreign import (
347
foreign_vcs_registry,
349
foreign_vcs_registry.register_lazy("git",
350
__name__ + ".mapping", "foreign_vcs_git", "Stupid content tracker")
373
353
def update_git_cache(repository, revid):
374
354
"""Update the git cache after a local commit."""