##// 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 if os.path.isdir(url) or url.startswith('file:'):
270 if os.path.isdir(url) or url.startswith('file:'):
271 return True
271 return True
272
272
273 if('+' in url[:url.find('://')]):
274 url = url[url.find('+')+1:]
275
273 handlers = []
276 handlers = []
274 test_uri, authinfo = Url(url).authinfo()
277 test_uri, authinfo = Url(url).authinfo()
275
278
@@ -370,13 +370,16 b' def SlugifyName():'
370 def ValidCloneUri():
370 def ValidCloneUri():
371 from rhodecode.lib.utils import make_ui
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 if repo_type == 'hg':
374 if repo_type == 'hg':
375 from mercurial.httprepo import httprepository, httpsrepository
375 from mercurial.httprepo import httprepository, httpsrepository
376 if proto == 'https':
376 if url.startswith('https'):
377 httpsrepository(make_ui('db'), url).capabilities
377 httpsrepository(make_ui('db'), url).capabilities
378 elif proto == 'http':
378 elif url.startswith('http'):
379 httprepository(make_ui('db'), url).capabilities
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 elif repo_type == 'git':
383 elif repo_type == 'git':
381 #TODO: write a git url validator
384 #TODO: write a git url validator
382 pass
385 pass
@@ -385,7 +388,7 b' def ValidCloneUri():'
385 messages = {
388 messages = {
386 'clone_uri': _(u'invalid clone url'),
389 'clone_uri': _(u'invalid clone url'),
387 'invalid_clone_uri': _(u'Invalid clone url, provide a '
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 def validate_python(self, value, state):
394 def validate_python(self, value, state):
@@ -394,21 +397,15 b' def ValidCloneUri():'
394
397
395 if not url:
398 if not url:
396 pass
399 pass
397 elif url.startswith('https') or url.startswith('http'):
400 else:
398 _type = 'https' if url.startswith('https') else 'http'
399 try:
401 try:
400 url_handler(repo_type, url, _type, make_ui('db'))
402 url_handler(repo_type, url, make_ui('db'))
401 except Exception:
403 except Exception:
402 log.exception('Url validation failed')
404 log.exception('Url validation failed')
403 msg = M(self, 'clone_uri')
405 msg = M(self, 'clone_uri')
404 raise formencode.Invalid(msg, value, state,
406 raise formencode.Invalid(msg, value, state,
405 error_dict=dict(clone_uri=msg)
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 return _validator
409 return _validator
413
410
414
411
General Comments 0
You need to be logged in to leave comments. Login now