peer: rename makepeer() → _make_peer()
authorManuel Jacob <me@manueljacob.de>
Fri, 07 Apr 2023 15:42:49 +0200
changeset 50458 ed052780ad5e
parent 50457 b88e9c707c95
child 50459 9fa3cda7449e
peer: rename makepeer() → _make_peer() In httppeer and sshpeer, there previously were makepeer() and make_peer(), which was confusing. Therefore, this changeset renames one of the functions. makepeer() was the internal function called by make_peer() and some debug command. This function is renamed to _make_peer().
mercurial/debugcommands.py
mercurial/httppeer.py
mercurial/sshpeer.py
--- a/mercurial/debugcommands.py	Tue Apr 04 11:58:35 2023 +0200
+++ b/mercurial/debugcommands.py	Fri Apr 07 15:42:49 2023 +0200
@@ -4512,7 +4512,7 @@
             peer = None
         else:
             ui.write(_(b'creating ssh peer from handshake results\n'))
-            peer = sshpeer.makepeer(
+            peer = sshpeer._make_peer(
                 ui,
                 url,
                 proc,
@@ -4568,7 +4568,7 @@
             )
         else:
             peer_path = urlutil.try_path(ui, path)
-            peer = httppeer.makepeer(ui, peer_path, opener=opener)
+            peer = httppeer._make_peer(ui, peer_path, opener=opener)
 
         # We /could/ populate stdin/stdout with sock.makefile()...
     else:
--- a/mercurial/httppeer.py	Tue Apr 04 11:58:35 2023 +0200
+++ b/mercurial/httppeer.py	Fri Apr 07 15:42:49 2023 +0200
@@ -592,7 +592,7 @@
     return respurl, info
 
 
-def makepeer(ui, path, opener=None, requestbuilder=urlreq.request):
+def _make_peer(ui, path, opener=None, requestbuilder=urlreq.request):
     """Construct an appropriate HTTP peer instance.
 
     ``opener`` is an ``url.opener`` that should be used to establish
@@ -628,7 +628,7 @@
                 _(b'Python support for SSL and HTTPS is not installed')
             )
 
-        inst = makepeer(ui, path)
+        inst = _make_peer(ui, path)
 
         return inst
     except error.RepoError as httpexception:
--- a/mercurial/sshpeer.py	Tue Apr 04 11:58:35 2023 +0200
+++ b/mercurial/sshpeer.py	Fri Apr 07 15:42:49 2023 +0200
@@ -568,7 +568,7 @@
             self._readerr()
 
 
-def makepeer(ui, path, proc, stdin, stdout, stderr, autoreadstderr=True):
+def _make_peer(ui, path, proc, stdin, stdout, stderr, autoreadstderr=True):
     """Make a peer instance from existing pipes.
 
     ``path`` and ``proc`` are stored on the eventual peer instance and may
@@ -658,7 +658,7 @@
         ui, sshcmd, args, remotecmd, remotepath, sshenv
     )
 
-    peer = makepeer(ui, path, proc, stdin, stdout, stderr)
+    peer = _make_peer(ui, path, proc, stdin, stdout, stderr)
 
     # Finally, if supported by the server, notify it about our own
     # capabilities.