mercurial/util.py
changeset 15027 1e45b92f4fb2
parent 15011 5e44e4b3a0a3
parent 15024 0f1311e829c9
child 15028 eb97a3e38656
equal deleted inserted replaced
15023:157a294444b2 15027:1e45b92f4fb2
  1466                 else:
  1466                 else:
  1467                     self.host = parts[0]
  1467                     self.host = parts[0]
  1468                     path = None
  1468                     path = None
  1469                 if not self.host:
  1469                 if not self.host:
  1470                     self.host = None
  1470                     self.host = None
       
  1471                     # path of file:///d is /d
       
  1472                     # path of file:///d:/ is d:/, not /d:/
  1471                     if path and not hasdriveletter(path):
  1473                     if path and not hasdriveletter(path):
  1472                         path = '/' + path
  1474                         path = '/' + path
  1473 
  1475 
  1474             if self.host and '@' in self.host:
  1476             if self.host and '@' in self.host:
  1475                 self.user, self.host = self.host.rsplit('@', 1)
  1477                 self.user, self.host = self.host.rsplit('@', 1)
  1585             s = str(self)
  1587             s = str(self)
  1586         finally:
  1588         finally:
  1587             self.user, self.passwd = user, passwd
  1589             self.user, self.passwd = user, passwd
  1588         if not self.user:
  1590         if not self.user:
  1589             return (s, None)
  1591             return (s, None)
  1590         return (s, (None, (str(self), self.host),
  1592         # authinfo[1] is passed to urllib2 password manager, and its URIs
       
  1593         # must not contain credentials.
       
  1594         return (s, (None, (s, self.host),
  1591                     self.user, self.passwd or ''))
  1595                     self.user, self.passwd or ''))
  1592 
  1596 
  1593     def isabs(self):
  1597     def isabs(self):
  1594         if self.scheme and self.scheme != 'file':
  1598         if self.scheme and self.scheme != 'file':
  1595             return True # remote URL
  1599             return True # remote URL
  1608             # letters to paths with drive letters.
  1612             # letters to paths with drive letters.
  1609             if hasdriveletter(self._hostport):
  1613             if hasdriveletter(self._hostport):
  1610                 path = self._hostport + '/' + self.path
  1614                 path = self._hostport + '/' + self.path
  1611             elif self.host is not None and self.path:
  1615             elif self.host is not None and self.path:
  1612                 path = '/' + path
  1616                 path = '/' + path
  1613             # We also need to handle the case of file:///C:/, which
       
  1614             # should return C:/, not /C:/.
       
  1615             elif hasdriveletter(path):
       
  1616                 # Strip leading slash from paths with drive names
       
  1617                 return path[1:]
       
  1618             return path
  1617             return path
  1619         return self._origpath
  1618         return self._origpath
  1620 
  1619 
  1621 def hasscheme(path):
  1620 def hasscheme(path):
  1622     return bool(url(path).scheme)
  1621     return bool(url(path).scheme)