diff -r 63ff8fe3a8f0 -r 8f4bad72d8b1 mercurial/util.py --- a/mercurial/util.py Fri Dec 02 21:38:57 2011 -0200 +++ b/mercurial/util.py Sun Dec 04 18:22:25 2011 +0100 @@ -1629,6 +1629,8 @@ 'path' >>> str(url('file:///tmp/foo/bar')) 'file:///tmp/foo/bar' + >>> str(url('file:///c:/tmp/foo/bar')) + 'file:///c%3A/tmp/foo/bar' >>> print url(r'bundle:foo\bar') bundle:foo\bar """ @@ -1643,8 +1645,11 @@ s = self.scheme + ':' if self.user or self.passwd or self.host: s += '//' - elif self.scheme and (not self.path or self.path.startswith('/')): + elif self.scheme and (not self.path or self.path.startswith('/') + or hasdriveletter(self.path)): s += '//' + if hasdriveletter(self.path): + s += '/' if self.user: s += urllib.quote(self.user, safe=self._safechars) if self.passwd: @@ -1716,7 +1721,7 @@ return bool(url(path).scheme) def hasdriveletter(path): - return path[1:2] == ':' and path[0:1].isalpha() + return path and path[1:2] == ':' and path[0:1].isalpha() def urllocalpath(path): return url(path, parsequery=False, parsefragment=False).localpath()