Changeset - 7a939ea3510a
[Not reviewed]
default
0 1 0
Mads Kiilerich - 6 years ago 2020-03-17 17:29:57
mads@kiilerich.com
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'.
1 file changed with 3 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/utils.py
Show inline comments
 
@@ -36,6 +36,7 @@ from distutils.version import StrictVers
 

	
 
import beaker.cache
 
import mercurial.config
 
import mercurial.error
 
import mercurial.ui
 

	
 
import kallithea.config.conf
 
@@ -235,6 +236,8 @@ def is_valid_repo_uri(repo_type, url, ui
 
                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
0 comments (0 inline, 0 general)