[PATCH 12 of 13 RFC] url: use url.url in ui.expandpath()

Brodie Rao brodie at bitheap.org
Wed Mar 30 22:11:57 CDT 2011


# HG changeset patch
# User Brodie Rao <brodie at bitheap.org>
# Date 1301540537 25200
# Node ID 9accc4f6a5e0f5162bfeba3b163497777eaab484
# Parent  04f3f2afd8d4c4c4879f6eec21b33baf74d6cf3b
url: use url.url in ui.expandpath()

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -7,7 +7,7 @@
 
 from i18n import _
 import errno, getpass, os, socket, sys, tempfile, traceback
-import config, util, error
+import config, util, error, url
 
 class ui(object):
     def __init__(self, src=None):
@@ -111,7 +111,7 @@ class ui(object):
                                   % (n, p, self.configsource('paths', n)))
                         p = p.replace('%%', '%')
                     p = util.expandpath(p)
-                    if '://' not in p and not os.path.isabs(p):
+                    if not url.has_scheme(p) and not os.path.isabs(p):
                         p = os.path.normpath(os.path.join(root, p))
                     c.set("paths", n, p)
 
@@ -325,7 +325,7 @@ class ui(object):
 
     def expandpath(self, loc, default=None):
         """Return repository location relative to cwd or from [paths]"""
-        if "://" in loc or os.path.isdir(os.path.join(loc, '.hg')):
+        if url.has_scheme(loc) or os.path.isdir(os.path.join(loc, '.hg')):
             return loc
 
         path = self.config('paths', loc)


More information about the Mercurial-devel mailing list