comparison mercurial/util.py @ 15018:e89f62dcd723 stable

url: really handle urls of the form file:///c:/foo/bar/ correctly 28edd65000d9 made sure that paths that seemed to start with a windows drive letter would not get an extra leading slash. localpath should thus not try to handle this case by removing a leading slash, and this special handling is thus removed. (The localpath handling of this case was wrong anyway, because paths that look like they start with a windows drive letter can't have a leading slash.) A quick verification of this is to run 'hg id file:///c:/foo/bar/'.
author Mads Kiilerich <mads@kiilerich.com>
date Thu, 04 Aug 2011 02:51:29 +0200
parents e6730f9e13bc
children 0f1311e829c9
comparison
equal deleted inserted replaced
15007:9991f8b19ff3 15018:e89f62dcd723
1442 else: 1442 else:
1443 self.host = parts[0] 1443 self.host = parts[0]
1444 path = None 1444 path = None
1445 if not self.host: 1445 if not self.host:
1446 self.host = None 1446 self.host = None
1447 # path of file:///d is /d
1448 # path of file:///d:/ is d:/, not /d:/
1447 if path and not hasdriveletter(path): 1449 if path and not hasdriveletter(path):
1448 path = '/' + path 1450 path = '/' + path
1449 1451
1450 if self.host and '@' in self.host: 1452 if self.host and '@' in self.host:
1451 self.user, self.host = self.host.rsplit('@', 1) 1453 self.user, self.host = self.host.rsplit('@', 1)
1584 # letters to paths with drive letters. 1586 # letters to paths with drive letters.
1585 if hasdriveletter(self._hostport): 1587 if hasdriveletter(self._hostport):
1586 path = self._hostport + '/' + self.path 1588 path = self._hostport + '/' + self.path
1587 elif self.host is not None and self.path: 1589 elif self.host is not None and self.path:
1588 path = '/' + path 1590 path = '/' + path
1589 # We also need to handle the case of file:///C:/, which
1590 # should return C:/, not /C:/.
1591 elif hasdriveletter(path):
1592 # Strip leading slash from paths with drive names
1593 return path[1:]
1594 return path 1591 return path
1595 return self._origpath 1592 return self._origpath
1596 1593
1597 def hasscheme(path): 1594 def hasscheme(path):
1598 return bool(url(path).scheme) 1595 return bool(url(path).scheme)