diff mercurial/hg.py @ 2595:edb66cb05ded

parse url schemes more strictly. previous code mistook repo named "hg" for scheme named "hg".
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Tue, 11 Jul 2006 15:52:36 -0700
parents 0875cda033fd
children 5ba8be56fa8f
line wrap: on
line diff
--- 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)