# HG changeset patch # User Mads Kiilerich # Date 1421858111 -3600 # Node ID 6d8a2c55b7d0a260f236727bfb16a87f44fbd7ac # Parent 47d2659ed5c09566a6e0118f852ed25f9736854f hg: fix clone from svn+http urls using hg-svn (Issue #72) diff -r 47d2659ed5c0 -r 6d8a2c55b7d0 kallithea/lib/vcs/backends/hg/repository.py --- a/kallithea/lib/vcs/backends/hg/repository.py Wed Jan 21 17:35:11 2015 +0100 +++ b/kallithea/lib/vcs/backends/hg/repository.py Wed Jan 21 17:35:11 2015 +0100 @@ -282,8 +282,9 @@ if os.path.isdir(url) or url.startswith('file:'): return True + url_prefix = None if '+' in url[:url.find('://')]: - url = url[url.find('+') + 1:] + url_prefix, url = url.split('+', 1) handlers = [] url_obj = hg_url(url) @@ -317,13 +318,14 @@ # means it cannot be cloned raise urllib2.URLError("[%s] org_exc: %s" % (cleaned_uri, e)) - # now check if it's a proper hg repo - try: - httppeer(repoui or ui.ui(), url).lookup('tip') - except Exception, e: - raise urllib2.URLError( - "url [%s] does not look like an hg repo org_exc: %s" - % (cleaned_uri, e)) + if not url_prefix: # skip svn+http://... (and git+... too) + # now check if it's a proper hg repo + try: + httppeer(repoui or ui.ui(), url).lookup('tip') + except Exception, e: + raise urllib2.URLError( + "url [%s] does not look like an hg repo org_exc: %s" + % (cleaned_uri, e)) return True