comparison mercurial/util.py @ 15452:de7e2fba4326

util: don't encode ':' in url paths ':' has no special meaning in paths, so there is no need for encoding it. Not encoding ':' makes it easier to test on windows.
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 07 Nov 2011 03:25:10 +0100
parents d7bfbc92a1c0
children 25ea33fe7e5c
comparison
equal deleted inserted replaced
15451:23144f06919c 15452:de7e2fba4326
1494 >>> url('http://host/a?b#c', parsequery=False, parsefragment=False) 1494 >>> url('http://host/a?b#c', parsequery=False, parsefragment=False)
1495 <url scheme: 'http', host: 'host', path: 'a?b#c'> 1495 <url scheme: 'http', host: 'host', path: 'a?b#c'>
1496 """ 1496 """
1497 1497
1498 _safechars = "!~*'()+" 1498 _safechars = "!~*'()+"
1499 _safepchars = "/!~*'()+" 1499 _safepchars = "/!~*'()+:"
1500 _matchscheme = re.compile(r'^[a-zA-Z0-9+.\-]+:').match 1500 _matchscheme = re.compile(r'^[a-zA-Z0-9+.\-]+:').match
1501 1501
1502 def __init__(self, path, parsequery=True, parsefragment=True): 1502 def __init__(self, path, parsequery=True, parsefragment=True):
1503 # We slowly chomp away at path until we have only the path left 1503 # We slowly chomp away at path until we have only the path left
1504 self.scheme = self.user = self.passwd = self.host = None 1504 self.scheme = self.user = self.passwd = self.host = None
1606 def __str__(self): 1606 def __str__(self):
1607 r"""Join the URL's components back into a URL string. 1607 r"""Join the URL's components back into a URL string.
1608 1608
1609 Examples: 1609 Examples:
1610 1610
1611 >>> str(url('http://user:pw@host:80/?foo#bar')) 1611 >>> str(url('http://user:pw@host:80/c:/bob?fo:oo#ba:ar'))
1612 'http://user:pw@host:80/?foo#bar' 1612 'http://user:pw@host:80/c:/bob?fo:oo#ba:ar'
1613 >>> str(url('http://user:pw@host:80/?foo=bar&baz=42')) 1613 >>> str(url('http://user:pw@host:80/?foo=bar&baz=42'))
1614 'http://user:pw@host:80/?foo=bar&baz=42' 1614 'http://user:pw@host:80/?foo=bar&baz=42'
1615 >>> str(url('http://user:pw@host:80/?foo=bar%3dbaz')) 1615 >>> str(url('http://user:pw@host:80/?foo=bar%3dbaz'))
1616 'http://user:pw@host:80/?foo=bar%3dbaz' 1616 'http://user:pw@host:80/?foo=bar%3dbaz'
1617 >>> str(url('ssh://user:pw@[::1]:2200//home/joe#')) 1617 >>> str(url('ssh://user:pw@[::1]:2200//home/joe#'))