parse url schemes more strictly.
authorVadim Gelfer <vadim.gelfer@gmail.com>
Tue, 11 Jul 2006 15:52:36 -0700
changeset 2595 edb66cb05ded
parent 2594 bdf9d809467c
child 2596 e3258cc3ed63
parse url schemes more strictly. previous code mistook repo named "hg" for scheme named "hg".
mercurial/hg.py
--- a/mercurial/hg.py	Tue Jul 11 15:51:16 2006 -0700
+++ b/mercurial/hg.py	Tue Jul 11 15:52:36 2006 -0700
@@ -58,11 +58,14 @@
     }
 
 def repository(ui, path=None, create=0):
-    if not path: path = ''
-    scheme = path
-    if scheme:
-        scheme = scheme.split(":", 1)[0]
-    ctor = schemes.get(scheme) or schemes['file']
+    scheme = None
+    if path:
+        c = path.find(':')
+        if c > 0:
+            scheme = schemes.get(path[:c])
+    else:
+        path = ''
+    ctor = scheme or schemes['file']
     if create:
         try:
             return ctor(ui, path, create)