[PATCH stable] Fix Issue 2111, test-schemes unit test failure
Mads Kiilerich
mads at kiilerich.com
Wed Apr 28 13:48:12 CDT 2010
It seems like this patch has been lost?
Full Python 2.6.2 support could be nice for 1.5.2.
/Mads
Michael Glassford wrote, On 04/08/2010 03:17 PM:
> # HG changeset patch
> # User Michael Glassford<glassfordmjg at gmail.com>
> # Date 1270731213 14400
> # Node ID ab12040bcec69f9f6bdfab0670bcc22a445a897a
> # Parent f97b98db6fd1de6c60c1b60254c9240337dadc01
> Fix Issue 2111, test-schemes unit test failure.
> Recent Pythons (e.g. 2.6.5 and 3.1) introduce a change that causes
> urlparse.urlunparse(urlparse.urlparse('x://')) to return 'x:' instead of 'x://'.
> Fix url.hidepassword() and url.removeauth() to handle this case.
>
> diff -r f97b98db6fd1 -r ab12040bcec6 mercurial/url.py
> --- a/mercurial/url.py Mon Apr 05 17:48:48 2010 -0500
> +++ b/mercurial/url.py Thu Apr 08 08:53:33 2010 -0400
> @@ -11,17 +11,35 @@
> from i18n import _
> import keepalive, util
>
> +def _urlunparse(scheme, netloc, path, params, query, fragment, url):
> + # Recent Pythons (e.g. 2.6.5 and 3.1) introduce a change that
> + # causes urlparse.urlunparse(urlparse.urlparse('x://')) to
> + # return 'x:' instead of 'x://' and
> + # urlparse.urlunparse(urlparse.urlparse('x:///y')) to
> + # return 'x:/y' instead of 'x:///y',
> + # unless "x" appears in the list urlparse.uses_netloc.
> + # Since we know the original url, re-add the missing "//"
> + # if the original url had it.
> + result = urlparse.urlunparse((scheme, netloc, path, params, query, fragment))
> + if (scheme and
> + result.startswith(scheme + ':') and
> + not result.startswith(scheme + '://') and
> + url.startswith(scheme + '://')
> + ):
> + result = scheme + '://' + result[len(scheme + ':'):]
> + return result
> +
> def hidepassword(url):
> '''hide user credential in a url string'''
> scheme, netloc, path, params, query, fragment = urlparse.urlparse(url)
> netloc = re.sub('([^:]*):([^@]*)@(.*)', r'\1:***@\3', netloc)
> - return urlparse.urlunparse((scheme, netloc, path, params, query, fragment))
> + return _urlunparse(scheme, netloc, path, params, query, fragment, url)
>
> def removeauth(url):
> '''remove all authentication information from a url string'''
> scheme, netloc, path, params, query, fragment = urlparse.urlparse(url)
> netloc = netloc[netloc.find('@')+1:]
> - return urlparse.urlunparse((scheme, netloc, path, params, query, fragment))
> + return _urlunparse(scheme, netloc, path, params, query, fragment, url)
>
> def netlocsplit(netloc):
> '''split [user[:passwd]@]host[:port] into 4-tuple.'''
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
More information about the Mercurial-devel
mailing list