changeset 7285:5ad99abfab79

url: detect scheme with a regexp instead of urlsplit() The latter says 'c' is a scheme in 'c:\foo\bar'
author Patrick Mezard <pmezard@gmail.com>
date Tue, 28 Oct 2008 23:54:01 +0100
parents ac81ffac0f35
children a1f8ad3c1821
files mercurial/url.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/url.py	Tue Oct 28 22:24:41 2008 +0100
+++ b/mercurial/url.py	Tue Oct 28 23:54:01 2008 +0100
@@ -298,8 +298,13 @@
     opener.addheaders.append(('Accept', 'application/mercurial-0.1'))
     return opener
 
+scheme_re = re.compile(r'^([a-zA-Z0-9+-.]+)://')
+
 def open(ui, url, data=None):
-    scheme = urlparse.urlsplit(url)[0]
+    scheme = None
+    m = scheme_re.search(url)
+    if m:
+        scheme = m.group(1).lower()
     if not scheme:
         path = util.normpath(os.path.abspath(url))
         url = 'file://' + urllib.pathname2url(path)