diff options
-rw-r--r-- | git_config.py | 5 | ||||
-rw-r--r-- | manifest_xml.py | 18 |
2 files changed, 14 insertions, 9 deletions
diff --git a/git_config.py b/git_config.py index f6093a25..af09ebae 100644 --- a/git_config.py +++ b/git_config.py | |||
@@ -576,7 +576,7 @@ class Remote(object): | |||
576 | return None | 576 | return None |
577 | 577 | ||
578 | u = self.review | 578 | u = self.review |
579 | if not u.startswith('http:') and not u.startswith('https:'): | 579 | if u.split(':')[0] not in ('http', 'https', 'sso'): |
580 | u = 'http://%s' % u | 580 | u = 'http://%s' % u |
581 | if u.endswith('/Gerrit'): | 581 | if u.endswith('/Gerrit'): |
582 | u = u[:len(u) - len('/Gerrit')] | 582 | u = u[:len(u) - len('/Gerrit')] |
@@ -592,6 +592,9 @@ class Remote(object): | |||
592 | host, port = os.environ['REPO_HOST_PORT_INFO'].split() | 592 | host, port = os.environ['REPO_HOST_PORT_INFO'].split() |
593 | self._review_url = self._SshReviewUrl(userEmail, host, port) | 593 | self._review_url = self._SshReviewUrl(userEmail, host, port) |
594 | REVIEW_CACHE[u] = self._review_url | 594 | REVIEW_CACHE[u] = self._review_url |
595 | elif u.startswith('sso:'): | ||
596 | self._review_url = u # Assume it's right | ||
597 | REVIEW_CACHE[u] = self._review_url | ||
595 | else: | 598 | else: |
596 | try: | 599 | try: |
597 | info_url = u + 'ssh_info' | 600 | info_url = u + 'ssh_info' |
diff --git a/manifest_xml.py b/manifest_xml.py index f2ac77a5..d496337c 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -80,18 +80,20 @@ class _XmlRemote(object): | |||
80 | def _resolveFetchUrl(self): | 80 | def _resolveFetchUrl(self): |
81 | url = self.fetchUrl.rstrip('/') | 81 | url = self.fetchUrl.rstrip('/') |
82 | manifestUrl = self.manifestUrl.rstrip('/') | 82 | manifestUrl = self.manifestUrl.rstrip('/') |
83 | p = manifestUrl.startswith('persistent-http') | 83 | # urljoin will gets confused over quite a few things. The ones we care |
84 | if p: | 84 | # about here are: |
85 | manifestUrl = manifestUrl[len('persistent-'):] | 85 | # * no scheme in the base url, like <hostname:port> |
86 | 86 | # * persistent-https:// | |
87 | # urljoin will get confused if there is no scheme in the base url | 87 | # We handle this by replacing these with obscure protocols |
88 | # ie, if manifestUrl is of the form <hostname:port> | 88 | # and then replacing them with the original when we are done. |
89 | # gopher -> <none> | ||
90 | # wais -> persistent-https | ||
89 | if manifestUrl.find(':') != manifestUrl.find('/') - 1: | 91 | if manifestUrl.find(':') != manifestUrl.find('/') - 1: |
90 | manifestUrl = 'gopher://' + manifestUrl | 92 | manifestUrl = 'gopher://' + manifestUrl |
93 | manifestUrl = re.sub(r'^persistent-https://', 'wais://', manifestUrl) | ||
91 | url = urllib.parse.urljoin(manifestUrl, url) | 94 | url = urllib.parse.urljoin(manifestUrl, url) |
92 | url = re.sub(r'^gopher://', '', url) | 95 | url = re.sub(r'^gopher://', '', url) |
93 | if p: | 96 | url = re.sub(r'^wais://', 'persistent-https://', url) |
94 | url = 'persistent-' + url | ||
95 | return url | 97 | return url |
96 | 98 | ||
97 | def ToRemoteSpec(self, projectName): | 99 | def ToRemoteSpec(self, projectName): |