# HG changeset patch # User Peter Arrenbrecht # Date 1305402247 -7200 # Node ID ec074ebaa80f918813926652f2e0d0ea788cfb33 # Parent a3f727c41c1d1fca385956c13449d2d0ce46c980 util: make islocalrepo() a bit more tolerant with file:// urls diff --git a/hgsubversion/util.py b/hgsubversion/util.py --- 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,