Try git protocol last when fetching.

De-prioritize the git protocol to maximize compatability.

Simplify some error messages.

Change-Id: I969e31135541e47c3506b27b0befdd333488bf90
This commit is contained in:
James E. Blair 2015-04-01 16:48:56 -07:00
parent bb4c83bf8d
commit 55a39ef3d5
1 changed files with 8 additions and 10 deletions

View File

@ -474,11 +474,7 @@ class SyncChangeTask(Task):
for remote_commit, remote_revision in remote_change.get('revisions', {}).items():
revision = session.getRevisionByCommit(remote_commit)
# TODO: handle multiple parents
if 'git' in remote_revision['fetch']:
ref = remote_revision['fetch']['git']['ref']
url = remote_revision['fetch']['git']['url']
auth = False
elif 'anonymous http' in remote_revision['fetch']:
if 'anonymous http' in remote_revision['fetch']:
ref = remote_revision['fetch']['anonymous http']['ref']
url = remote_revision['fetch']['anonymous http']['url']
auth = False
@ -494,14 +490,16 @@ class SyncChangeTask(Task):
ref = remote_revision['fetch']['ssh']['ref']
url = remote_revision['fetch']['ssh']['url']
auth = False
elif 'git' in remote_revision['fetch']:
ref = remote_revision['fetch']['git']['ref']
url = remote_revision['fetch']['git']['url']
auth = False
else:
if len(remote_revision['fetch']):
errMessage = 'Don\'t know how to download changes. ' \
'Server offered these schemes, but Gertty doesn\'t support any of them: %s' \
% ', '.join(remote_revision['fetch'].keys())
errMessage = "No supported fetch method found. Server offers: %s" % (
', '.join(remote_revision['fetch'].keys()))
else:
errMessage = 'The server is missing the download-commands plugin. ' \
'Don\'t know how to download revisions.'
errMessage = "The server is missing the download-commands plugin."
raise Exception(errMessage)
if (not revision) or self.force_fetch:
fetches[url].append('+%(ref)s:%(ref)s' % dict(ref=ref))