comparison mercurial/hg.py @ 2595:edb66cb05ded

parse url schemes more strictly. previous code mistook repo named "hg" for scheme named "hg".
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Tue, 11 Jul 2006 15:52:36 -0700
parents 0875cda033fd
children 5ba8be56fa8f
comparison
equal deleted inserted replaced
2594:bdf9d809467c 2595:edb66cb05ded
56 'ssh': ssh_, 56 'ssh': ssh_,
57 'static-http': static_http, 57 'static-http': static_http,
58 } 58 }
59 59
60 def repository(ui, path=None, create=0): 60 def repository(ui, path=None, create=0):
61 if not path: path = '' 61 scheme = None
62 scheme = path 62 if path:
63 if scheme: 63 c = path.find(':')
64 scheme = scheme.split(":", 1)[0] 64 if c > 0:
65 ctor = schemes.get(scheme) or schemes['file'] 65 scheme = schemes.get(path[:c])
66 else:
67 path = ''
68 ctor = scheme or schemes['file']
66 if create: 69 if create:
67 try: 70 try:
68 return ctor(ui, path, create) 71 return ctor(ui, path, create)
69 except TypeError: 72 except TypeError:
70 raise util.Abort(_('cannot create new repository over "%s" protocol') % 73 raise util.Abort(_('cannot create new repository over "%s" protocol') %