comparison mercurial/util.py @ 14699:388af80c058b stable

url: catch UNC paths as yet another Windows special case (issue2808)
author Matt Mackall <mpm@selenic.com>
date Mon, 20 Jun 2011 16:45:33 -0500
parents 406b6d7bdcb9
children 4f56b7530eab
comparison
equal deleted inserted replaced
14698:df902fe3d79e 14699:388af80c058b
1357 <url scheme: 'bundle', path: 'foo'> 1357 <url scheme: 'bundle', path: 'foo'>
1358 >>> url('bundle://../foo') 1358 >>> url('bundle://../foo')
1359 <url scheme: 'bundle', path: '../foo'> 1359 <url scheme: 'bundle', path: '../foo'>
1360 >>> url(r'c:\foo\bar') 1360 >>> url(r'c:\foo\bar')
1361 <url path: 'c:\\foo\\bar'> 1361 <url path: 'c:\\foo\\bar'>
1362 >>> url(r'\\blah\blah\blah')
1363 <url path: '\\\\blah\\blah\\blah'>
1362 1364
1363 Authentication credentials: 1365 Authentication credentials:
1364 1366
1365 >>> url('ssh://joe:xyz@x/repo') 1367 >>> url('ssh://joe:xyz@x/repo')
1366 <url scheme: 'ssh', user: 'joe', passwd: 'xyz', host: 'x', path: 'repo'> 1368 <url scheme: 'ssh', user: 'joe', passwd: 'xyz', host: 'x', path: 'repo'>
1385 self.port = self.path = self.query = self.fragment = None 1387 self.port = self.path = self.query = self.fragment = None
1386 self._localpath = True 1388 self._localpath = True
1387 self._hostport = '' 1389 self._hostport = ''
1388 self._origpath = path 1390 self._origpath = path
1389 1391
1390 # special case for Windows drive letters 1392 # special case for Windows drive letters and UNC paths
1391 if hasdriveletter(path): 1393 if hasdriveletter(path) or path.startswith(r'\\'):
1392 self.path = path 1394 self.path = path
1393 return 1395 return
1394 1396
1395 # For compatibility reasons, we can't handle bundle paths as 1397 # For compatibility reasons, we can't handle bundle paths as
1396 # normal URLS 1398 # normal URLS