# HG changeset patch # User Matt Mackall # Date 1301586233 18000 # Node ID f1823b9f073bd376e19fc544c2891609458891e4 # Parent e574207e3bcd30b66bb914d92b5b210cf9921256 url: nuke some newly-introduced underbars in identifiers diff -r e574207e3bcd -r f1823b9f073b hgext/schemes.py --- 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) diff -r e574207e3bcd -r f1823b9f073b mercurial/sshrepo.py --- 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)) diff -r e574207e3bcd -r f1823b9f073b mercurial/ui.py --- 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) diff -r e574207e3bcd -r f1823b9f073b mercurial/url.py --- 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('http://host/a?b#c', parse_query=False, parse_fragment=False) + >>> url('http://host/a?b#c', parsequery=False, parsefragment=False) """ _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''' diff -r e574207e3bcd -r f1823b9f073b tests/test-url.py --- 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('http://host/?a#b') - >>> url('http://host/?a#b', parse_query=False) + >>> url('http://host/?a#b', parsequery=False) - >>> url('http://host/?a#b', parse_fragment=False) + >>> url('http://host/?a#b', parsefragment=False) - >>> url('http://host/?a#b', parse_query=False, parse_fragment=False) + >>> url('http://host/?a#b', parsequery=False, parsefragment=False) IPv6 addresses: