# HG changeset patch # User Marcin Kuzminski # Date 1344448594 -7200 # Node ID 48fad3a6e2f8ffab66ebce3de7e959c52184708c # Parent 4eef5eeb81a399928fc85964d3494907defc1a01# Parent 24c5d90208957f40c73e288f269eec1073cb42c9 Merged in domruf/rhodecode (pull request #64) diff -r 4eef5eeb81a3 -r 48fad3a6e2f8 rhodecode/lib/vcs/backends/hg/repository.py --- a/rhodecode/lib/vcs/backends/hg/repository.py Tue Aug 07 23:02:50 2012 +0200 +++ b/rhodecode/lib/vcs/backends/hg/repository.py Wed Aug 08 19:56:34 2012 +0200 @@ -270,6 +270,9 @@ if os.path.isdir(url) or url.startswith('file:'): return True + if('+' in url[:url.find('://')]): + url = url[url.find('+')+1:] + handlers = [] test_uri, authinfo = Url(url).authinfo() diff -r 4eef5eeb81a3 -r 48fad3a6e2f8 rhodecode/model/validators.py --- a/rhodecode/model/validators.py Tue Aug 07 23:02:50 2012 +0200 +++ b/rhodecode/model/validators.py Wed Aug 08 19:56:34 2012 +0200 @@ -370,13 +370,16 @@ def ValidCloneUri(): from rhodecode.lib.utils import make_ui - def url_handler(repo_type, url, proto, ui=None): + def url_handler(repo_type, url, ui=None): if repo_type == 'hg': from mercurial.httprepo import httprepository, httpsrepository - if proto == 'https': + if url.startswith('https'): httpsrepository(make_ui('db'), url).capabilities - elif proto == 'http': + elif url.startswith('http'): httprepository(make_ui('db'), url).capabilities + elif url.startswith('svn+http'): + from hgsubversion.svnrepo import svnremoterepo + svnremoterepo(make_ui('db'), url).capabilities elif repo_type == 'git': #TODO: write a git url validator pass @@ -385,7 +388,7 @@ messages = { 'clone_uri': _(u'invalid clone url'), 'invalid_clone_uri': _(u'Invalid clone url, provide a ' - 'valid clone http\s url') + 'valid clone http(s)/svn+http(s) url') } def validate_python(self, value, state): @@ -394,21 +397,15 @@ if not url: pass - elif url.startswith('https') or url.startswith('http'): - _type = 'https' if url.startswith('https') else 'http' + else: try: - url_handler(repo_type, url, _type, make_ui('db')) + url_handler(repo_type, url, make_ui('db')) except Exception: log.exception('Url validation failed') msg = M(self, 'clone_uri') raise formencode.Invalid(msg, value, state, error_dict=dict(clone_uri=msg) ) - else: - msg = M(self, 'invalid_clone_uri', state) - raise formencode.Invalid(msg, value, state, - error_dict=dict(clone_uri=msg) - ) return _validator