mercurial/sshpeer.py
changeset 35931 b202d360d2a4
parent 35928 b0d2885c5945
child 35932 31449baf0936
--- a/mercurial/sshpeer.py	Sun Feb 04 14:02:41 2018 -0800
+++ b/mercurial/sshpeer.py	Sun Feb 04 12:55:18 2018 -0800
@@ -121,13 +121,6 @@
         self._pipeo = self._pipei = self._pipee = None
 
         u = util.url(path, parsequery=False, parsefragment=False)
-        if u.scheme != 'ssh' or not u.host or u.path is None:
-            self._abort(error.RepoError(_("couldn't parse location %s") % path))
-
-        util.checksafessh(path)
-
-        if u.passwd is not None:
-            self._abort(error.RepoError(_("password in URL not supported")))
 
         self._user = u.user
         self._host = u.host
@@ -371,4 +364,17 @@
         self._readerr()
 
 def instance(ui, path, create):
+    """Create an SSH peer.
+
+    The returned object conforms to the ``wireproto.wirepeer`` interface.
+    """
+    u = util.url(path, parsequery=False, parsefragment=False)
+    if u.scheme != 'ssh' or not u.host or u.path is None:
+        raise error.RepoError(_("couldn't parse location %s") % path)
+
+    util.checksafessh(path)
+
+    if u.passwd is not None:
+        raise error.RepoError(_('password in URL not supported'))
+
     return sshpeer(ui, path, create=create)