comparison hgext/schemes.py @ 15609:8f4bad72d8b1 stable

util: fix url.__str__() for windows file URLs Before: >>> str(url('file:///c:/tmp/foo/bar')) 'file:c%3C/tmp/foo/bar' After: >>> str(url('file:///c:/tmp/foo/bar')) 'file:///c%3C/tmp/foo/bar' The previous behaviour had no effect on mercurial itself (clone command for instance) because we fortunately called .localpath() on the parsed URL. hgsubversion was not so lucky and cloning a local subversion repository on Windows no longer worked on the default branch (it works on stable because de7e2fba4326 defeats the hasdriveletter() test in url class). I do not know if the %3C is correct or not but svn accepts file:// URLs containing it. Mads fixed it in de7e2fba4326, so we can always backport should the need arise.
author Patrick Mezard <pmezard@gmail.com>
date Sun, 04 Dec 2011 18:22:25 +0100
parents 6e631c24c6d9
children 38caf405d010
comparison
equal deleted inserted replaced
15608:63ff8fe3a8f0 15609:8f4bad72d8b1
70 context = dict((str(i + 1), v) for i, v in enumerate(parts)) 70 context = dict((str(i + 1), v) for i, v in enumerate(parts))
71 url = ''.join(self.templater.process(self.url, context)) + tail 71 url = ''.join(self.templater.process(self.url, context)) + tail
72 return hg._peerlookup(url).instance(ui, url, create) 72 return hg._peerlookup(url).instance(ui, url, create)
73 73
74 def hasdriveletter(orig, path): 74 def hasdriveletter(orig, path):
75 for scheme in schemes: 75 if path:
76 if path.startswith(scheme + ':'): 76 for scheme in schemes:
77 return False 77 if path.startswith(scheme + ':'):
78 return False
78 return orig(path) 79 return orig(path)
79 80
80 schemes = { 81 schemes = {
81 'py': 'http://hg.python.org/', 82 'py': 'http://hg.python.org/',
82 'bb': 'https://bitbucket.org/', 83 'bb': 'https://bitbucket.org/',