Mercurial > public > src > rhodecode
changeset 2804:48fad3a6e2f8 beta
Merged in domruf/rhodecode (pull request #64)
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 08 Aug 2012 19:56:34 +0200 |
parents | 4eef5eeb81a3 (current diff) 24c5d9020895 (diff) |
children | 02ec22d017c2 |
files | |
diffstat | 2 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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()
--- 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