Mercurial > hg
comparison hgext/convert/subversion.py @ 8764:46b5b4301fcc
convert: default to file protocol when no :// found for svn repo url
Edited by pmezard: add path separator normalization
author | Edouard Gomez <ed.gomez@free.fr> |
---|---|
date | Sat, 06 Jun 2009 00:08:37 +0200 |
parents | 68e0a55eee6e |
children | c5f36402daad |
comparison
equal
deleted
inserted
replaced
8763:fccdf5ca5065 | 8764:46b5b4301fcc |
---|---|
159 protomap = {'http': httpcheck, | 159 protomap = {'http': httpcheck, |
160 'https': httpcheck, | 160 'https': httpcheck, |
161 'file': filecheck, | 161 'file': filecheck, |
162 } | 162 } |
163 def issvnurl(url): | 163 def issvnurl(url): |
164 if not '://' in url: | 164 try: |
165 return False | 165 proto, path = url.split('://', 1) |
166 proto, path = url.split('://', 1) | 166 path = urllib.url2pathname(path) |
167 path = urllib.url2pathname(path).replace(os.sep, '/') | 167 except ValueError: |
168 proto = 'file' | |
169 path = os.path.abspath(url) | |
170 path = path.replace(os.sep, '/') | |
168 check = protomap.get(proto, lambda p, p2: False) | 171 check = protomap.get(proto, lambda p, p2: False) |
169 while '/' in path: | 172 while '/' in path: |
170 if check(path, proto): | 173 if check(path, proto): |
171 return True | 174 return True |
172 path = path.rsplit('/', 1)[0] | 175 path = path.rsplit('/', 1)[0] |