changeset 13827:f1823b9f073b

url: nuke some newly-introduced underbars in identifiers
author Matt Mackall <mpm@selenic.com>
date Thu, 31 Mar 2011 10:43:53 -0500
parents e574207e3bcd
children b975a326aec0
files hgext/schemes.py mercurial/sshrepo.py mercurial/ui.py mercurial/url.py tests/test-url.py
diffstat 5 files changed, 20 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/schemes.py	Wed Mar 30 20:03:05 2011 -0700
+++ b/hgext/schemes.py	Thu Mar 31 10:43:53 2011 -0500
@@ -71,7 +71,7 @@
         url = ''.join(self.templater.process(self.url, context)) + tail
         return hg._lookup(url).instance(ui, url, create)
 
-def has_drive_letter(orig, path):
+def hasdriveletter(orig, path):
     for scheme in schemes:
         if path.startswith(scheme + ':'):
             return False
@@ -95,4 +95,4 @@
                                'letter %s:\\\n') % (scheme, scheme.upper()))
         hg.schemes[scheme] = ShortRepository(url, scheme, t)
 
-    extensions.wrapfunction(urlmod, 'has_drive_letter', has_drive_letter)
+    extensions.wrapfunction(urlmod, 'hasdriveletter', hasdriveletter)
--- a/mercurial/sshrepo.py	Wed Mar 30 20:03:05 2011 -0700
+++ b/mercurial/sshrepo.py	Thu Mar 31 10:43:53 2011 -0500
@@ -23,7 +23,7 @@
         self._url = path
         self.ui = ui
 
-        u = url.url(path, parse_query=False, parse_fragment=False)
+        u = url.url(path, parsequery=False, parsefragment=False)
         if u.scheme != 'ssh' or not u.host or u.path is None:
             self._abort(error.RepoError(_("couldn't parse location %s") % path))
 
--- a/mercurial/ui.py	Wed Mar 30 20:03:05 2011 -0700
+++ b/mercurial/ui.py	Thu Mar 31 10:43:53 2011 -0500
@@ -111,7 +111,7 @@
                                   % (n, p, self.configsource('paths', n)))
                         p = p.replace('%%', '%')
                     p = util.expandpath(p)
-                    if not url.has_scheme(p) and not os.path.isabs(p):
+                    if not url.hasscheme(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 @@
 
     def expandpath(self, loc, default=None):
         """Return repository location relative to cwd or from [paths]"""
-        if url.has_scheme(loc) or os.path.isdir(os.path.join(loc, '.hg')):
+        if url.hasscheme(loc) or os.path.isdir(os.path.join(loc, '.hg')):
             return loc
 
         path = self.config('paths', loc)
--- a/mercurial/url.py	Wed Mar 30 20:03:05 2011 -0700
+++ b/mercurial/url.py	Thu Mar 31 10:43:53 2011 -0500
@@ -23,8 +23,8 @@
     Missing components are set to None. The only exception is
     fragment, which is set to '' if present but empty.
 
-    If parse_fragment is False, fragment is included in query. If
-    parse_query is False, query is included in path. If both are
+    If parsefragment is False, fragment is included in query. If
+    parsequery is False, query is included in path. If both are
     False, both fragment and query are included in path.
 
     See http://www.ietf.org/rfc/rfc2396.txt for more information.
@@ -58,14 +58,14 @@
 
     >>> url('http://host/a?b#c')
     <url scheme: 'http', host: 'host', path: 'a', query: 'b', fragment: 'c'>
-    >>> url('http://host/a?b#c', parse_query=False, parse_fragment=False)
+    >>> url('http://host/a?b#c', parsequery=False, parsefragment=False)
     <url scheme: 'http', host: 'host', path: 'a?b#c'>
     """
 
     _safechars = "!~*'()+"
     _safepchars = "/!~*'()+"
 
-    def __init__(self, path, parse_query=True, parse_fragment=True):
+    def __init__(self, path, parsequery=True, parsefragment=True):
         # We slowly chomp away at path until we have only the path left
         self.scheme = self.user = self.passwd = self.host = None
         self.port = self.path = self.query = self.fragment = None
@@ -74,7 +74,7 @@
         self._origpath = path
 
         # special case for Windows drive letters
-        if has_drive_letter(path):
+        if hasdriveletter(path):
             self.path = path
             return
 
@@ -100,7 +100,7 @@
                 self.path = ''
                 return
         else:
-            if parse_fragment and '#' in path:
+            if parsefragment and '#' in path:
                 path, self.fragment = path.split('#', 1)
                 if not path:
                     path = None
@@ -108,7 +108,7 @@
                 self.path = path
                 return
 
-            if parse_query and '?' in path:
+            if parsequery and '?' in path:
                 path, self.query = path.split('?', 1)
                 if not path:
                     path = None
@@ -239,26 +239,26 @@
             path = self.path or '/'
             # For Windows, we need to promote hosts containing drive
             # letters to paths with drive letters.
-            if has_drive_letter(self._hostport):
+            if hasdriveletter(self._hostport):
                 path = self._hostport + '/' + self.path
             elif self.host is not None and self.path:
                 path = '/' + path
             # We also need to handle the case of file:///C:/, which
             # should return C:/, not /C:/.
-            elif has_drive_letter(path):
+            elif hasdriveletter(path):
                 # Strip leading slash from paths with drive names
                 return path[1:]
             return path
         return self._origpath
 
-def has_scheme(path):
+def hasscheme(path):
     return bool(url(path).scheme)
 
-def has_drive_letter(path):
+def hasdriveletter(path):
     return path[1:2] == ':' and path[0:1].isalpha()
 
 def localpath(path):
-    return url(path, parse_query=False, parse_fragment=False).localpath()
+    return url(path, parsequery=False, parsefragment=False).localpath()
 
 def hidepassword(u):
     '''hide user credential in a url string'''
--- a/tests/test-url.py	Wed Mar 30 20:03:05 2011 -0700
+++ b/tests/test-url.py	Thu Mar 31 10:43:53 2011 -0500
@@ -71,11 +71,11 @@
     <url scheme: 'http', host: 'host', path: 'a', fragment: 'b?c'>
     >>> url('http://host/?a#b')
     <url scheme: 'http', host: 'host', path: '', query: 'a', fragment: 'b'>
-    >>> url('http://host/?a#b', parse_query=False)
+    >>> url('http://host/?a#b', parsequery=False)
     <url scheme: 'http', host: 'host', path: '?a', fragment: 'b'>
-    >>> url('http://host/?a#b', parse_fragment=False)
+    >>> url('http://host/?a#b', parsefragment=False)
     <url scheme: 'http', host: 'host', path: '', query: 'a#b'>
-    >>> url('http://host/?a#b', parse_query=False, parse_fragment=False)
+    >>> url('http://host/?a#b', parsequery=False, parsefragment=False)
     <url scheme: 'http', host: 'host', path: '?a#b'>
 
     IPv6 addresses: