Mercurial > public > mercurial-scm > hg
comparison mercurial/url.py @ 13814:03dfe0c85c1a
url: move drive letter checking into has_drive_letter() for extensions
This will let the schemes extension override drive letter detection to
allow single letter schemes.
author | Brodie Rao <brodie@bitheap.org> |
---|---|
date | Wed, 30 Mar 2011 19:50:56 -0700 |
parents | 974490c1768f |
children | d066d8d652c8 |
comparison
equal
deleted
inserted
replaced
13813:76593ef397ef | 13814:03dfe0c85c1a |
---|---|
65 self.scheme = self.user = self.passwd = self.host = None | 65 self.scheme = self.user = self.passwd = self.host = None |
66 self.port = self.path = self.query = self.fragment = None | 66 self.port = self.path = self.query = self.fragment = None |
67 self._localpath = True | 67 self._localpath = True |
68 | 68 |
69 # special case for Windows drive letters | 69 # special case for Windows drive letters |
70 if path[1:2] == ':' and path[0:1].isalpha(): | 70 if has_drive_letter(path): |
71 self.path = path | 71 self.path = path |
72 return | 72 return |
73 | 73 |
74 if not path.startswith('/') and ':' in path: | 74 if not path.startswith('/') and ':' in path: |
75 parts = path.split(':', 1) | 75 parts = path.split(':', 1) |
208 return (s, (None, (str(self), self.host), | 208 return (s, (None, (str(self), self.host), |
209 self.user, self.passwd or '')) | 209 self.user, self.passwd or '')) |
210 | 210 |
211 def has_scheme(path): | 211 def has_scheme(path): |
212 return bool(url(path).scheme) | 212 return bool(url(path).scheme) |
213 | |
214 def has_drive_letter(path): | |
215 return path[1:2] == ':' and path[0:1].isalpha() | |
213 | 216 |
214 def hidepassword(u): | 217 def hidepassword(u): |
215 '''hide user credential in a url string''' | 218 '''hide user credential in a url string''' |
216 u = url(u) | 219 u = url(u) |
217 if u.passwd: | 220 if u.passwd: |