diff options
author | Conley Owens <cco3@android.com> | 2011-10-20 10:45:47 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2011-10-20 11:01:38 -0700 |
commit | ceea368e887b1c1c600400f40564eca4f8b40192 (patch) | |
tree | 5cdd2d5a985e6b10e9f5116ad5a5aa7065ef7105 /manifest_xml.py | |
parent | b660539c4ac691312b44c13c6311568749537290 (diff) | |
download | git-repo-ceea368e887b1c1c600400f40564eca4f8b40192.tar.gz |
Correctly name projects when mirroringv1.7.7.5
A bug introduced by relative urls caused projects such as manifest.git
to be placed in the root directory instead of the directory they should
by in.
This fix creates and refers to a resolvedFetchUrl in the _XmlRemote
class in order to get a fetchUrl that is never relative.
Diffstat (limited to 'manifest_xml.py')
-rw-r--r-- | manifest_xml.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/manifest_xml.py b/manifest_xml.py index 476472fb..02a5f9ae 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -46,16 +46,20 @@ class _XmlRemote(object): | |||
46 | self.fetchUrl = fetch | 46 | self.fetchUrl = fetch |
47 | self.manifestUrl = manifestUrl | 47 | self.manifestUrl = manifestUrl |
48 | self.reviewUrl = review | 48 | self.reviewUrl = review |
49 | self.resolvedFetchUrl = self._resolveFetchUrl() | ||
49 | 50 | ||
50 | def ToRemoteSpec(self, projectName): | 51 | def _resolveFetchUrl(self): |
51 | url = self.fetchUrl.rstrip('/') + '/' + projectName + '.git' | 52 | url = self.fetchUrl.rstrip('/') |
52 | manifestUrl = self.manifestUrl.rstrip('/') | 53 | manifestUrl = self.manifestUrl.rstrip('/') |
53 | # urljoin will get confused if there is no scheme in the base url | 54 | # urljoin will get confused if there is no scheme in the base url |
54 | # ie, if manifestUrl is of the form <hostname:port> | 55 | # ie, if manifestUrl is of the form <hostname:port> |
55 | if manifestUrl.find(':') != manifestUrl.find('/') - 1: | 56 | if manifestUrl.find(':') != manifestUrl.find('/') - 1: |
56 | manifestUrl = 'gopher://' + manifestUrl | 57 | manifestUrl = 'gopher://' + manifestUrl |
57 | url = urlparse.urljoin(manifestUrl, url) | 58 | url = urlparse.urljoin(manifestUrl, url) |
58 | url = re.sub(r'^gopher://', '', url) | 59 | return re.sub(r'^gopher://', '', url) |
60 | |||
61 | def ToRemoteSpec(self, projectName): | ||
62 | url = self.resolvedFetchUrl + '/' + projectName | ||
59 | return RemoteSpec(self.name, url, self.reviewUrl) | 63 | return RemoteSpec(self.name, url, self.reviewUrl) |
60 | 64 | ||
61 | class XmlManifest(object): | 65 | class XmlManifest(object): |
@@ -368,7 +372,7 @@ class XmlManifest(object): | |||
368 | raise ManifestParseError, 'refusing to mirror %s' % m_url | 372 | raise ManifestParseError, 'refusing to mirror %s' % m_url |
369 | 373 | ||
370 | if self._default and self._default.remote: | 374 | if self._default and self._default.remote: |
371 | url = self._default.remote.fetchUrl | 375 | url = self._default.remote.resolvedFetchUrl |
372 | if not url.endswith('/'): | 376 | if not url.endswith('/'): |
373 | url += '/' | 377 | url += '/' |
374 | if m_url.startswith(url): | 378 | if m_url.startswith(url): |