Mercurial > hgsubversion
changeset 806:ec074ebaa80f
util: make islocalrepo() a bit more tolerant with file:// urls
author | Peter Arrenbrecht <peter.arrenbrecht@gmail.com> |
---|---|
date | Sat, 14 May 2011 21:44:07 +0200 |
parents | a3f727c41c1d |
children | 800d293f907d |
files | hgsubversion/util.py |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hgsubversion/util.py +++ b/hgsubversion/util.py @@ -53,11 +53,16 @@ def parentrev(ui, repo, meta, hashes): def islocalrepo(url): - if not url.startswith('file:///'): + path = str(url) # convert once up front + if path.startswith('file:///'): + prefixlen = len('file://') + elif path.startswith('file:/'): + prefixlen = len('file:') + else: return False - if '#' in url.split('/')[-1]: # strip off #anchor - url = url[:url.rfind('#')] - path = url[len('file://'):] + if '#' in path.split('/')[-1]: # strip off #anchor + path = path[:path.rfind('#')] + path = url[prefixlen:] path = urllib.url2pathname(path).replace(os.sep, '/') while '/' in path: if reduce(lambda x,y: x and y,