diff -r 8251f7cc787d -r 76fbb1b6692a mercurial/keepalive.py --- 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