# HG changeset patch # User domruf # Date 2012-08-01 14:10:26 # Node ID f4b20558ae16adbe0dd7106da2528d955bc6ff2e # Parent 04d2bcfbe7a6d7067df135a4f54d15b3f60e4158 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 diff --git a/rhodecode/lib/vcs/backends/hg/repository.py b/rhodecode/lib/vcs/backends/hg/repository.py --- a/rhodecode/lib/vcs/backends/hg/repository.py +++ b/rhodecode/lib/vcs/backends/hg/repository.py @@ -270,6 +270,9 @@ class MercurialRepository(BaseRepository 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 --git a/rhodecode/model/validators.py b/rhodecode/model/validators.py --- a/rhodecode/model/validators.py +++ b/rhodecode/model/validators.py @@ -377,6 +377,8 @@ def ValidCloneUri(): 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 @@ def ValidCloneUri(): 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 @@ def ValidCloneUri(): 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: