# HG changeset patch # User Mads Kiilerich # Date 1584462597 -3600 # Node ID 7a939ea3510aa4464103b030f909be14851584a4 # Parent 2fa9f497faacf13a2a6e8438f85abeea4ca83a92 hg: handle Mercurial RepoError correctly in is_valid_repo_uri RepoError would be leaked by is_valid_repo_uri. Now, when for example validating an ssh URL without having the ssh client binary, it will be shown/logged as: remote: /bin/sh: ssh: command not found 2020-03-17 17:28:53.907 WARNI [kallithea.model.validators] validation of clone URL 'ssh://no-ssh.com/' failed: Mercurial RepoError: no suitable response from remote hg and shown in the UI as 'Invalid repository URL'. diff -r 2fa9f497faac -r 7a939ea3510a kallithea/lib/utils.py --- a/kallithea/lib/utils.py Tue Mar 17 17:15:59 2020 +0100 +++ b/kallithea/lib/utils.py Tue Mar 17 17:29:57 2020 +0100 @@ -36,6 +36,7 @@ import beaker.cache import mercurial.config +import mercurial.error import mercurial.ui import kallithea.config.conf @@ -235,6 +236,8 @@ MercurialRepository._check_url(url, ui) except urllib.error.URLError as e: raise InvalidCloneUriException('URI %s URLError: %s' % (url, e)) + except mercurial.error.RepoError as e: + raise InvalidCloneUriException('Mercurial %s: %s' % (type(e).__name__, safe_str(bytes(e)))) elif url.startswith('svn+http'): try: from hgsubversion.svnrepo import svnremoterepo