comparison hgext/schemes.py @ 14568:5f002e3336ba

hg: split peer and repo lookup tables
author Matt Mackall <mpm@selenic.com>
date Sat, 11 Jun 2011 14:14:52 -0500
parents 924c82157d46
children 9f1139cf5c76
comparison
equal deleted inserted replaced
14567:b72cef1b8b26 14568:5f002e3336ba
67 parts = parts[:-1] 67 parts = parts[:-1]
68 else: 68 else:
69 tail = '' 69 tail = ''
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._lookup(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 for scheme in schemes:
76 if path.startswith(scheme + ':'): 76 if path.startswith(scheme + ':'):
77 return False 77 return False
91 for scheme, url in schemes.items(): 91 for scheme, url in schemes.items():
92 if (os.name == 'nt' and len(scheme) == 1 and scheme.isalpha() 92 if (os.name == 'nt' and len(scheme) == 1 and scheme.isalpha()
93 and os.path.exists('%s:\\' % scheme)): 93 and os.path.exists('%s:\\' % scheme)):
94 raise util.Abort(_('custom scheme %s:// conflicts with drive ' 94 raise util.Abort(_('custom scheme %s:// conflicts with drive '
95 'letter %s:\\\n') % (scheme, scheme.upper())) 95 'letter %s:\\\n') % (scheme, scheme.upper()))
96 hg.schemes[scheme] = ShortRepository(url, scheme, t) 96 hg._peerschemes[scheme] = ShortRepository(url, scheme, t)
97 97
98 extensions.wrapfunction(util, 'hasdriveletter', hasdriveletter) 98 extensions.wrapfunction(util, 'hasdriveletter', hasdriveletter)