comparison cmdutil.py @ 289:75d4fde9aa2e

cmdutil: fix islocalrepo() under Windows
author Patrick Mezard <pmezard@gmail.com>
date Tue, 28 Apr 2009 21:16:35 +0200
parents f8f9a2993705
children b6a9cdee2f68
comparison
equal deleted inserted replaced
288:982c46e7d167 289:75d4fde9aa2e
284 def islocalrepo(url): 284 def islocalrepo(url):
285 if not url.startswith('file:///'): 285 if not url.startswith('file:///'):
286 return False 286 return False
287 if '#' in url.split('/')[-1]: # strip off #anchor 287 if '#' in url.split('/')[-1]: # strip off #anchor
288 url = url[:url.rfind('#')] 288 url = url[:url.rfind('#')]
289 path = urllib.unquote(url[len('file://'):]) 289 path = url[len('file://'):]
290 path = urllib.url2pathname(path).replace(os.sep, '/')
290 while '/' in path: 291 while '/' in path:
291 if reduce(lambda x,y: x and y, 292 if reduce(lambda x,y: x and y,
292 map(lambda p: os.path.exists(os.path.join(path, p)), 293 map(lambda p: os.path.exists(os.path.join(path, p)),
293 ('hooks', 'format', 'db', ))): 294 ('hooks', 'format', 'db', ))):
294 return True 295 return True