1. Dies Koper
  2. RhodeCode

Commits

Marcin Kuzminski  committed 48fad3a Merge

Merged in domruf/rhodecode (pull request #64)

  • Participants
  • Parent commits 4eef5ee, 24c5d90
  • Branches beta

Comments (0)

Files changed (2)

File rhodecode/lib/vcs/backends/hg/repository.py

View file
  • Ignore whitespace
         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()
 

File rhodecode/model/validators.py

View file
  • Ignore whitespace
 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
         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):
 
             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