changeset 4771:6d8a2c55b7d0

hg: fix clone from svn+http urls using hg-svn (Issue #72)
author Mads Kiilerich <madski@unity3d.com>
date Wed, 21 Jan 2015 17:35:11 +0100
parents 47d2659ed5c0
children 7b7b7262e837
files kallithea/lib/vcs/backends/hg/repository.py
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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