mercurial/keepalive.py
branchstable
changeset 49535 76fbb1b6692a
parent 49534 8251f7cc787d
child 50952 18c8c18993f0
--- a/mercurial/keepalive.py	Tue Oct 18 11:54:58 2022 -0400
+++ b/mercurial/keepalive.py	Tue Oct 18 12:58:34 2022 -0400
@@ -702,6 +702,17 @@
         self.sentbytescount = 0
         self.receivedbytescount = 0
 
+    def __repr__(self):
+        base = super(HTTPConnection, self).__repr__()
+        local = "(unconnected)"
+        s = self.sock
+        if s:
+            try:
+                local = "%s:%d" % s.getsockname()
+            except OSError:
+                pass  # Likely not connected
+        return "<%s: %s <--> %s:%d>" % (base, local, self.host, self.port)
+
 
 #########################################################################
 #####   TEST FUNCTIONS