summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConley Owens <cco3@android.com>2013-06-05 13:16:18 -0700
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2013-09-27 19:15:34 +0900
commit745a39ba3dca7699ac057887e79deeb47e2bf8a5 (patch)
tree03681b89e5e20230249468002e208622eb92a02e
parentefc986c5081fc9a504b698672d955300a99f24bb (diff)
downloadgit-repo-745a39ba3dca7699ac057887e79deeb47e2bf8a5.tar.gz
Assume http upload if ssh_info cannot be parsed
When uploading a change for review, we sometimes request /ssh_info to get the correct port number for uploading via ssh (regardless of whether or not we intend to upload over ssh). If we have trouble accessing /ssh_info (for authentication reasons, etc), we now press on under the assumption that we will upload via http instead of aborting. Change-Id: Ica6bbeac1279e89424a903529649b7f4af0b6937
-rw-r--r--git_config.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/git_config.py b/git_config.py
index 2270200c..a294a0b6 100644
--- a/git_config.py
+++ b/git_config.py
@@ -596,14 +596,11 @@ class Remote(object):
596 try: 596 try:
597 info_url = u + 'ssh_info' 597 info_url = u + 'ssh_info'
598 info = urllib.request.urlopen(info_url).read() 598 info = urllib.request.urlopen(info_url).read()
599 if '<' in info: 599 if info == 'NOT_AVAILABLE' or '<' in info:
600 # Assume the server gave us some sort of HTML 600 # If `info` contains '<', we assume the server gave us some sort
601 # response back, like maybe a login page. 601 # of HTML response back, like maybe a login page.
602 # 602 #
603 raise UploadError('%s: Cannot parse response' % info_url) 603 # Assume HTTP if SSH is not enabled or ssh_info doesn't look right.
604
605 if info == 'NOT_AVAILABLE':
606 # Assume HTTP if SSH is not enabled.
607 self._review_url = http_url + 'p/' 604 self._review_url = http_url + 'p/'
608 else: 605 else:
609 host, port = info.split() 606 host, port = info.split()