comparison mercurial/url.py @ 7285:5ad99abfab79

url: detect scheme with a regexp instead of urlsplit() The latter says 'c' is a scheme in 'c:\foo\bar'
author Patrick Mezard <pmezard@gmail.com>
date Tue, 28 Oct 2008 23:54:01 +0100
parents ac81ffac0f35
children bbc24c0753a0
comparison
equal deleted inserted replaced
7284:ac81ffac0f35 7285:5ad99abfab79
296 # 1.0 here is the _protocol_ version 296 # 1.0 here is the _protocol_ version
297 opener.addheaders = [('User-agent', 'mercurial/proto-1.0')] 297 opener.addheaders = [('User-agent', 'mercurial/proto-1.0')]
298 opener.addheaders.append(('Accept', 'application/mercurial-0.1')) 298 opener.addheaders.append(('Accept', 'application/mercurial-0.1'))
299 return opener 299 return opener
300 300
301 scheme_re = re.compile(r'^([a-zA-Z0-9+-.]+)://')
302
301 def open(ui, url, data=None): 303 def open(ui, url, data=None):
302 scheme = urlparse.urlsplit(url)[0] 304 scheme = None
305 m = scheme_re.search(url)
306 if m:
307 scheme = m.group(1).lower()
303 if not scheme: 308 if not scheme:
304 path = util.normpath(os.path.abspath(url)) 309 path = util.normpath(os.path.abspath(url))
305 url = 'file://' + urllib.pathname2url(path) 310 url = 'file://' + urllib.pathname2url(path)
306 authinfo = None 311 authinfo = None
307 else: 312 else: