[PATCH] Accept file://localhost/ style urls as local

Christian Ebert blacktrash at gmx.net
Fri Sep 7 03:02:52 CDT 2007


* Brendan Cully on Thursday, September 06, 2007 at 19:28:10 -0700
> I'd be tempted to just skip over the host part of a file: URL --
> anything other than a local hostname is probably useless anyway.

That makes things a lot easier ;)


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1189151971 -7200
# Node ID 929eb15943665108d162ecd18b6d5089ef76514a
# Parent  cbec83d9b0b435da94ebabca0a4169eafc745994
Drop local hostnames with url scheme in file urls

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1680,4 +1680,7 @@ def drop_scheme(scheme, path):
         path = path[len(sc):]
         if path.startswith('//'):
             path = path[2:]
+        if scheme == 'file' and not path.startswith('/'):
+            # drop local hostname
+            path = '/' + path.split('/', 1)[1]
     return path


More information about the Mercurial-devel mailing list