[PATCH 01 of 13 RFC] url: move drive letter checking into has_drive_letter() for extensions
Brodie Rao
brodie at bitheap.org
Thu Mar 31 03:11:46 UTC 2011
# HG changeset patch
# User Brodie Rao <brodie at bitheap.org>
# Date 1301539856 25200
# Node ID 1d94b8fdd3963e2f1286b08fe8a46e76569fae65
# Parent 58b86b9149f1c636b102790a7bbe8b5919e140cf
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.
diff --git a/mercurial/url.py b/mercurial/url.py
--- a/mercurial/url.py
+++ b/mercurial/url.py
@@ -67,7 +67,7 @@ class url(object):
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 @@ class url(object):
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)
More information about the Mercurial-devel
mailing list