Mercurial > hg-stable
changeset 13815:d066d8d652c8
url: add trailing slashes to URLs with hostnames that don't have one
This works around a potential issue in Python 2.4 where cloning a repo
with a URL like http://foo:8080 would cause urllib2 to query on
http://foo:8080?cmd=capabilities instead of
http://foo:8080/?cmd=capabilities.
In the past, this issue has been masked by the fact that
url.getauthinfo() added a trailing slash when it was missing.
author | Brodie Rao <brodie@bitheap.org> |
---|---|
date | Wed, 30 Mar 2011 20:00:23 -0700 |
parents | 03dfe0c85c1a |
children | 2540f8087e02 |
files | mercurial/url.py tests/test-http-branchmap.t tests/test-schemes.t |
diffstat | 3 files changed, 4 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/url.py Wed Mar 30 19:50:56 2011 -0700 +++ b/mercurial/url.py Wed Mar 30 20:00:23 2011 -0700 @@ -156,7 +156,7 @@ >>> str(url('http://localhost:80/')) 'http://localhost:80/' >>> str(url('http://localhost:80')) - 'http://localhost:80' + 'http://localhost:80/' >>> str(url('bundle:foo')) 'bundle:foo' >>> str(url('path')) @@ -185,8 +185,7 @@ s += self.host if self.port: s += ':' + urllib.quote(self.port) - if ((self.host and self.path is not None) or - (self.host and self.query or self.fragment)): + if self.host: s += '/' if self.path: s += urllib.quote(self.path, safe=self._safepchars)
--- a/tests/test-http-branchmap.t Wed Mar 30 19:50:56 2011 -0700 +++ b/tests/test-http-branchmap.t Wed Mar 30 20:00:23 2011 -0700 @@ -30,7 +30,7 @@ $ echo bar >> b/foo $ hg -R b ci -m bar $ hg --encoding utf-8 -R b push - pushing to http://localhost:$HGPORT1 + pushing to http://localhost:$HGPORT1/ searching for changes remote: adding changesets remote: adding manifests
--- a/tests/test-schemes.t Wed Mar 30 19:50:56 2011 -0700 +++ b/tests/test-schemes.t Wed Mar 30 20:00:23 2011 -0700 @@ -26,7 +26,7 @@ $ hg incoming --debug parts://localhost using http://localhost:$HGPORT/ sending capabilities command - comparing with parts://localhost + comparing with parts://localhost/ sending heads command searching for changes sending known command