summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Pearce <sop@google.com>2013-01-02 15:40:48 -0800
committerShawn Pearce <sop@google.com>2013-01-02 15:41:57 -0800
commita9f11b3cb281270084526a490dc61625b51b8192 (patch)
tree040d3144fd3c540b7b2d1a381ea28ac14ba42129
parent7bdbde7af84036d2d900150e67f462e1a50f4b0e (diff)
downloadgit-repo-a9f11b3cb281270084526a490dc61625b51b8192.tar.gz
Support resolving relative fetch URLs on persistent-https://v1.12.0
Some versions of Python will only attempt to resolve a relative URL if they understand the URL scheme. Convert persistent-http:// and persistent-https:// schemes to the more typical http:// and https:// versions for the resolve call. Change-Id: I99072d5a69be8cfaa429a3ab177ba644d928ffba
-rw-r--r--manifest_xml.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/manifest_xml.py b/manifest_xml.py
index 36f8ef87..0664eff9 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -65,12 +65,19 @@ class _XmlRemote(object):
65 def _resolveFetchUrl(self): 65 def _resolveFetchUrl(self):
66 url = self.fetchUrl.rstrip('/') 66 url = self.fetchUrl.rstrip('/')
67 manifestUrl = self.manifestUrl.rstrip('/') 67 manifestUrl = self.manifestUrl.rstrip('/')
68 p = manifestUrl.startswith('persistent-http')
69 if p:
70 manifestUrl = manifestUrl[len('persistent-'):]
71
68 # urljoin will get confused if there is no scheme in the base url 72 # urljoin will get confused if there is no scheme in the base url
69 # ie, if manifestUrl is of the form <hostname:port> 73 # ie, if manifestUrl is of the form <hostname:port>
70 if manifestUrl.find(':') != manifestUrl.find('/') - 1: 74 if manifestUrl.find(':') != manifestUrl.find('/') - 1:
71 manifestUrl = 'gopher://' + manifestUrl 75 manifestUrl = 'gopher://' + manifestUrl
72 url = urlparse.urljoin(manifestUrl, url) 76 url = urlparse.urljoin(manifestUrl, url)
73 return re.sub(r'^gopher://', '', url) 77 url = re.sub(r'^gopher://', '', url)
78 if p:
79 url = 'persistent-' + url
80 return url
74 81
75 def ToRemoteSpec(self, projectName): 82 def ToRemoteSpec(self, projectName):
76 url = self.resolvedFetchUrl.rstrip('/') + '/' + projectName 83 url = self.resolvedFetchUrl.rstrip('/') + '/' + projectName