##// END OF EJS Templates
url: fix crash by empty path with #fragments...
Yuya Nishihara -
r30036:3f4e1c03 default
parent child Browse files
Show More
@@ -2377,6 +2377,22 b' class url(object):'
2377 <url scheme: 'http', host: 'host', path: 'a', query: 'b', fragment: 'c'>
2377 <url scheme: 'http', host: 'host', path: 'a', query: 'b', fragment: 'c'>
2378 >>> url('http://host/a?b#c', parsequery=False, parsefragment=False)
2378 >>> url('http://host/a?b#c', parsequery=False, parsefragment=False)
2379 <url scheme: 'http', host: 'host', path: 'a?b#c'>
2379 <url scheme: 'http', host: 'host', path: 'a?b#c'>
2380
2381 Empty path:
2382
2383 >>> url('')
2384 <url path: ''>
2385 >>> url('#a')
2386 <url path: '', fragment: 'a'>
2387 >>> url('http://host/')
2388 <url scheme: 'http', host: 'host', path: ''>
2389 >>> url('http://host/#a')
2390 <url scheme: 'http', host: 'host', path: '', fragment: 'a'>
2391
2392 Only scheme:
2393
2394 >>> url('http:')
2395 <url scheme: 'http'>
2380 """
2396 """
2381
2397
2382 _safechars = "!~*'()+"
2398 _safechars = "!~*'()+"
@@ -2393,8 +2409,6 b' class url(object):'
2393
2409
2394 if parsefragment and '#' in path:
2410 if parsefragment and '#' in path:
2395 path, self.fragment = path.split('#', 1)
2411 path, self.fragment = path.split('#', 1)
2396 if not path:
2397 path = None
2398
2412
2399 # special case for Windows drive letters and UNC paths
2413 # special case for Windows drive letters and UNC paths
2400 if hasdriveletter(path) or path.startswith(r'\\'):
2414 if hasdriveletter(path) or path.startswith(r'\\'):
@@ -320,3 +320,12 b' Test handling common incoming revisions '
320 remote: 1 outgoing
320 remote: 1 outgoing
321
321
322 $ cd ..
322 $ cd ..
323
324 Test url#rev syntax of local destination path, which should be taken as
325 a 'url#rev' path
326
327 $ hg clone repo '#foo'
328 updating to branch default
329 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
330 $ hg root -R '#foo'
331 $TESTTMP/#foo (glob)
General Comments 0
You need to be logged in to leave comments. Login now