url: move drive letter checking into has_drive_letter() for extensions
authorBrodie Rao <brodie@bitheap.org>
Wed, 30 Mar 2011 19:50:56 -0700
changeset 13814 03dfe0c85c1a
parent 13813 76593ef397ef
child 13815 d066d8d652c8
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.
mercurial/url.py
--- a/mercurial/url.py	Thu Mar 31 10:03:24 2011 -0500
+++ b/mercurial/url.py	Wed Mar 30 19:50:56 2011 -0700
@@ -67,7 +67,7 @@
         self._localpath = True
 
         # special case for Windows drive letters
-        if path[1:2] == ':' and path[0:1].isalpha():
+        if has_drive_letter(path):
             self.path = path
             return
 
@@ -211,6 +211,9 @@
 def has_scheme(path):
     return bool(url(path).scheme)
 
+def has_drive_letter(path):
+    return path[1:2] == ':' and path[0:1].isalpha()
+
 def hidepassword(u):
     '''hide user credential in a url string'''
     u = url(u)