[PATCH 08 of 11 RFC] hg: look up schemes using url.url

Brodie Rao brodie at bitheap.org
Sat Mar 26 01:29:43 CDT 2011


# HG changeset patch
# User Brodie Rao <brodie at bitheap.org>
# Date 1301119177 25200
# Node ID 0655facb4d07f6f1d7eb162e764667f6f0cb145c
# Parent  8c42ec63cc5bd43e7c9fe53356c77daf1c72c0a5
hg: look up schemes using url.url

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -69,11 +69,8 @@ schemes = {
 }
 
 def _lookup(path):
-    scheme = 'file'
-    if path:
-        c = path.find(':')
-        if c > 0:
-            scheme = path[:c]
+    u = url.url(path)
+    scheme = u.scheme or 'file'
     thing = schemes.get(scheme) or schemes['file']
     try:
         return thing(path)


More information about the Mercurial-devel mailing list