def url_handler(repo_type, url, proto, ui=None): if repo_type == 'hg': from mercurial.httprepo import httprepository, httpsrepository if proto == 'https': httpsrepository(make_ui('db'), url).capabilities elif proto == 'http': httprepository(make_ui('db'), url).capabilities elif repo_type == 'git': #TODO: write a git url validator pass
def to_python(self, value, state): if not value: pass elif value.startswith('https'): try: httpsrepository(make_ui('db'), value).capabilities except Exception, e: log.error(traceback.format_exc()) raise formencode.Invalid(_('invalid clone url'), value, state)