##// END OF EJS Templates
allow cloning with hgsubversion (reimplementing pull request 46)...
domruf -
r2700:f4b20558 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
@@ -377,6 +377,8 b' def ValidCloneUri():'
377 httpsrepository(make_ui('db'), url).capabilities
377 httpsrepository(make_ui('db'), url).capabilities
378 elif proto == 'http':
378 elif proto == 'http':
379 httprepository(make_ui('db'), url).capabilities
379 httprepository(make_ui('db'), url).capabilities
380 elif proto == 'svn+http':
381 svnremoterepo(make_ui('db'), url).capabilities
380 elif repo_type == 'git':
382 elif repo_type == 'git':
381 #TODO: write a git url validator
383 #TODO: write a git url validator
382 pass
384 pass
@@ -385,7 +387,7 b' def ValidCloneUri():'
385 messages = {
387 messages = {
386 'clone_uri': _(u'invalid clone url'),
388 'clone_uri': _(u'invalid clone url'),
387 'invalid_clone_uri': _(u'Invalid clone url, provide a '
389 'invalid_clone_uri': _(u'Invalid clone url, provide a '
388 'valid clone http\s url')
390 'valid clone http(s)/svn+http(s) url')
389 }
391 }
390
392
391 def validate_python(self, value, state):
393 def validate_python(self, value, state):
@@ -394,8 +396,21 b' def ValidCloneUri():'
394
396
395 if not url:
397 if not url:
396 pass
398 pass
397 elif url.startswith('https') or url.startswith('http'):
399 elif url.startswith('https') or \
398 _type = 'https' if url.startswith('https') else 'http'
400 url.startswith('http') or \
401 url.startswith('svn+http'):
402 if url.startswith('https'):
403 _type = 'https'
404 elif url.startswith('http'):
405 _type = 'http'
406 elif url.startswith('svn+http'):
407 try:
408 from hgsubversion.svnrepo import svnremoterepo
409 global svnremoterepo
410 except ImportError:
411 raise formencode.Invalid(_('invalid clone url: hgsubversion '
412 'is not installed'), value, state)
413 _type = 'svn+http'
399 try:
414 try:
400 url_handler(repo_type, url, _type, make_ui('db'))
415 url_handler(repo_type, url, _type, make_ui('db'))
401 except Exception:
416 except Exception:
General Comments 0
You need to be logged in to leave comments. Login now