comparison mercurial/util.py @ 14146:1618c4f6f15b

tests: use raw string for url tests of '\' handling
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 01 May 2011 15:49:13 +0200
parents 3e9e02a41dfb
children 617483af1cc0
comparison
equal deleted inserted replaced
14134:8468ec1109d1 14146:1618c4f6f15b
1317 except UnicodeDecodeError: 1317 except UnicodeDecodeError:
1318 s += unichr(int(item[:2], 16)) + item[2:] 1318 s += unichr(int(item[:2], 16)) + item[2:]
1319 return s 1319 return s
1320 1320
1321 class url(object): 1321 class url(object):
1322 """Reliable URL parser. 1322 r"""Reliable URL parser.
1323 1323
1324 This parses URLs and provides attributes for the following 1324 This parses URLs and provides attributes for the following
1325 components: 1325 components:
1326 1326
1327 <scheme>://<user>:<passwd>@<host>:<port>/<path>?<query>#<fragment> 1327 <scheme>://<user>:<passwd>@<host>:<port>/<path>?<query>#<fragment>
1348 <url scheme: 'file', path: '/home/joe/repo'> 1348 <url scheme: 'file', path: '/home/joe/repo'>
1349 >>> url('bundle:foo') 1349 >>> url('bundle:foo')
1350 <url scheme: 'bundle', path: 'foo'> 1350 <url scheme: 'bundle', path: 'foo'>
1351 >>> url('bundle://../foo') 1351 >>> url('bundle://../foo')
1352 <url scheme: 'bundle', path: '../foo'> 1352 <url scheme: 'bundle', path: '../foo'>
1353 >>> url('c:\\\\foo\\\\bar') 1353 >>> url(r'c:\foo\bar')
1354 <url path: 'c:\\\\foo\\\\bar'> 1354 <url path: 'c:\\foo\\bar'>
1355 1355
1356 Authentication credentials: 1356 Authentication credentials:
1357 1357
1358 >>> url('ssh://joe:xyz@x/repo') 1358 >>> url('ssh://joe:xyz@x/repo')
1359 <url scheme: 'ssh', user: 'joe', passwd: 'xyz', host: 'x', path: 'repo'> 1359 <url scheme: 'ssh', user: 'joe', passwd: 'xyz', host: 'x', path: 'repo'>