Show More
@@ -72,6 +72,7 b' class ShortRepository(object):' | |||||
72 | return hg._peerlookup(url).instance(ui, url, create) |
|
72 | return hg._peerlookup(url).instance(ui, url, create) | |
73 |
|
73 | |||
74 | def hasdriveletter(orig, path): |
|
74 | def hasdriveletter(orig, path): | |
|
75 | if path: | |||
75 | for scheme in schemes: |
|
76 | for scheme in schemes: | |
76 | if path.startswith(scheme + ':'): |
|
77 | if path.startswith(scheme + ':'): | |
77 | return False |
|
78 | return False |
@@ -1629,6 +1629,8 b' class url(object):' | |||||
1629 | 'path' |
|
1629 | 'path' | |
1630 | >>> str(url('file:///tmp/foo/bar')) |
|
1630 | >>> str(url('file:///tmp/foo/bar')) | |
1631 | 'file:///tmp/foo/bar' |
|
1631 | 'file:///tmp/foo/bar' | |
|
1632 | >>> str(url('file:///c:/tmp/foo/bar')) | |||
|
1633 | 'file:///c%3A/tmp/foo/bar' | |||
1632 | >>> print url(r'bundle:foo\bar') |
|
1634 | >>> print url(r'bundle:foo\bar') | |
1633 | bundle:foo\bar |
|
1635 | bundle:foo\bar | |
1634 | """ |
|
1636 | """ | |
@@ -1643,8 +1645,11 b' class url(object):' | |||||
1643 | s = self.scheme + ':' |
|
1645 | s = self.scheme + ':' | |
1644 | if self.user or self.passwd or self.host: |
|
1646 | if self.user or self.passwd or self.host: | |
1645 | s += '//' |
|
1647 | s += '//' | |
1646 |
elif self.scheme and (not self.path or self.path.startswith('/') |
|
1648 | elif self.scheme and (not self.path or self.path.startswith('/') | |
|
1649 | or hasdriveletter(self.path)): | |||
1647 | s += '//' |
|
1650 | s += '//' | |
|
1651 | if hasdriveletter(self.path): | |||
|
1652 | s += '/' | |||
1648 | if self.user: |
|
1653 | if self.user: | |
1649 | s += urllib.quote(self.user, safe=self._safechars) |
|
1654 | s += urllib.quote(self.user, safe=self._safechars) | |
1650 | if self.passwd: |
|
1655 | if self.passwd: | |
@@ -1716,7 +1721,7 b' def hasscheme(path):' | |||||
1716 | return bool(url(path).scheme) |
|
1721 | return bool(url(path).scheme) | |
1717 |
|
1722 | |||
1718 | def hasdriveletter(path): |
|
1723 | def hasdriveletter(path): | |
1719 | return path[1:2] == ':' and path[0:1].isalpha() |
|
1724 | return path and path[1:2] == ':' and path[0:1].isalpha() | |
1720 |
|
1725 | |||
1721 | def urllocalpath(path): |
|
1726 | def urllocalpath(path): | |
1722 | return url(path, parsequery=False, parsefragment=False).localpath() |
|
1727 | return url(path, parsequery=False, parsefragment=False).localpath() |
@@ -219,7 +219,7 b' def test_url():' | |||||
219 | >>> u |
|
219 | >>> u | |
220 | <url scheme: 'file', path: 'f:oo/bar/baz'> |
|
220 | <url scheme: 'file', path: 'f:oo/bar/baz'> | |
221 | >>> str(u) |
|
221 | >>> str(u) | |
222 | 'file:f%3Aoo/bar/baz' |
|
222 | 'file:///f%3Aoo/bar/baz' | |
223 | >>> u.localpath() |
|
223 | >>> u.localpath() | |
224 | 'f:oo/bar/baz' |
|
224 | 'f:oo/bar/baz' | |
225 |
|
225 |
General Comments 0
You need to be logged in to leave comments.
Login now