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) diff --git a/tests/test-pull.t b/tests/test-pull.t --- a/tests/test-pull.t +++ b/tests/test-pull.t @@ -68,7 +68,7 @@ Issue622: hg init && hg pull -u URL does Test 'file:' uri handling: $ hg pull -q file://../test-doesnt-exist - abort: repository /test-doesnt-exist not found! + abort: file:// URLs can only refer to localhost [255] $ hg pull -q file:../test