Mercurial > kallithea
changeset 2700:f4b20558ae16 beta
allow cloning with hgsubversion (reimplementing pull request 46)
sadly I get a exception from hg-git when doing the same for git+http URLs
so I did not implement it for hg-git
author | domruf <dominikruf@gmail.com> |
---|---|
date | Wed, 01 Aug 2012 14:10:26 +0200 |
parents | 04d2bcfbe7a6 |
children | 24c5d9020895 |
files | rhodecode/lib/vcs/backends/hg/repository.py rhodecode/model/validators.py |
diffstat | 2 files changed, 21 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/lib/vcs/backends/hg/repository.py Tue Jul 31 00:27:22 2012 +0200 +++ b/rhodecode/lib/vcs/backends/hg/repository.py Wed Aug 01 14:10:26 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 Jul 31 00:27:22 2012 +0200 +++ b/rhodecode/model/validators.py Wed Aug 01 14:10:26 2012 +0200 @@ -377,6 +377,8 @@ httpsrepository(make_ui('db'), url).capabilities elif proto == 'http': httprepository(make_ui('db'), url).capabilities + elif proto == 'svn+http': + svnremoterepo(make_ui('db'), url).capabilities elif repo_type == 'git': #TODO: write a git url validator pass @@ -385,7 +387,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,8 +396,21 @@ if not url: pass - elif url.startswith('https') or url.startswith('http'): - _type = 'https' if url.startswith('https') else 'http' + elif url.startswith('https') or \ + url.startswith('http') or \ + url.startswith('svn+http'): + if url.startswith('https'): + _type = 'https' + elif url.startswith('http'): + _type = 'http' + elif url.startswith('svn+http'): + try: + from hgsubversion.svnrepo import svnremoterepo + global svnremoterepo + except ImportError: + raise formencode.Invalid(_('invalid clone url: hgsubversion ' + 'is not installed'), value, state) + _type = 'svn+http' try: url_handler(repo_type, url, _type, make_ui('db')) except Exception: