##// END OF EJS Templates
Merged in domruf/rhodecode (pull request #64)
marcink -
r2702:48fad3a6 merge beta
parent child Browse files
Show More
@@ -270,6 +270,9 b' class MercurialRepository(BaseRepository'
270 270 if os.path.isdir(url) or url.startswith('file:'):
271 271 return True
272 272
273 if('+' in url[:url.find('://')]):
274 url = url[url.find('+')+1:]
275
273 276 handlers = []
274 277 test_uri, authinfo = Url(url).authinfo()
275 278
@@ -370,13 +370,16 b' def SlugifyName():'
370 370 def ValidCloneUri():
371 371 from rhodecode.lib.utils import make_ui
372 372
373 def url_handler(repo_type, url, proto, ui=None):
373 def url_handler(repo_type, url, ui=None):
374 374 if repo_type == 'hg':
375 375 from mercurial.httprepo import httprepository, httpsrepository
376 if proto == 'https':
376 if url.startswith('https'):
377 377 httpsrepository(make_ui('db'), url).capabilities
378 elif proto == 'http':
378 elif url.startswith('http'):
379 379 httprepository(make_ui('db'), url).capabilities
380 elif url.startswith('svn+http'):
381 from hgsubversion.svnrepo import svnremoterepo
382 svnremoterepo(make_ui('db'), url).capabilities
380 383 elif repo_type == 'git':
381 384 #TODO: write a git url validator
382 385 pass
@@ -385,7 +388,7 b' def ValidCloneUri():'
385 388 messages = {
386 389 'clone_uri': _(u'invalid clone url'),
387 390 'invalid_clone_uri': _(u'Invalid clone url, provide a '
388 'valid clone http\s url')
391 'valid clone http(s)/svn+http(s) url')
389 392 }
390 393
391 394 def validate_python(self, value, state):
@@ -394,21 +397,15 b' def ValidCloneUri():'
394 397
395 398 if not url:
396 399 pass
397 elif url.startswith('https') or url.startswith('http'):
398 _type = 'https' if url.startswith('https') else 'http'
400 else:
399 401 try:
400 url_handler(repo_type, url, _type, make_ui('db'))
402 url_handler(repo_type, url, make_ui('db'))
401 403 except Exception:
402 404 log.exception('Url validation failed')
403 405 msg = M(self, 'clone_uri')
404 406 raise formencode.Invalid(msg, value, state,
405 407 error_dict=dict(clone_uri=msg)
406 408 )
407 else:
408 msg = M(self, 'invalid_clone_uri', state)
409 raise formencode.Invalid(msg, value, state,
410 error_dict=dict(clone_uri=msg)
411 )
412 409 return _validator
413 410
414 411
General Comments 0
You need to be logged in to leave comments. Login now