peer: get the `path` object down to the sshpeer
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sat, 03 Dec 2022 06:16:58 +0100
changeset 49761 73ed1d13c0bf
parent 49760 5bceea1a8234
child 49762 c4d587fa161c
peer: get the `path` object down to the sshpeer Same logic as the other peers.
mercurial/sshpeer.py
--- a/mercurial/sshpeer.py	Sat Dec 03 06:16:45 2022 +0100
+++ b/mercurial/sshpeer.py	Sat Dec 03 06:16:58 2022 +0100
@@ -372,7 +372,7 @@
 
 class sshv1peer(wireprotov1peer.wirepeer):
     def __init__(
-        self, ui, url, proc, stdin, stdout, stderr, caps, autoreadstderr=True
+        self, ui, path, proc, stdin, stdout, stderr, caps, autoreadstderr=True
     ):
         """Create a peer from an existing SSH connection.
 
@@ -383,8 +383,7 @@
         ``autoreadstderr`` denotes whether to automatically read from
         stderr and to forward its output.
         """
-        super().__init__(ui)
-        self._url = url
+        super().__init__(ui, path=path)
         # self._subprocess is unused. Keeping a handle on the process
         # holds a reference and prevents it from being garbage collected.
         self._subprocess = proc
@@ -411,7 +410,7 @@
     # Begin of ipeerconnection interface.
 
     def url(self):
-        return self._url
+        return self.path.loc
 
     def local(self):
         return None
@@ -612,12 +611,11 @@
 
     The returned object conforms to the ``wireprotov1peer.wirepeer`` interface.
     """
-    path = path.loc
-    u = urlutil.url(path, parsequery=False, parsefragment=False)
+    u = urlutil.url(path.loc, parsequery=False, parsefragment=False)
     if u.scheme != b'ssh' or not u.host or u.path is None:
         raise error.RepoError(_(b"couldn't parse location %s") % path)
 
-    urlutil.checksafessh(path)
+    urlutil.checksafessh(path.loc)
 
     if u.passwd is not None:
         raise error.RepoError(_(b'password in URL not supported'))