--- a/mercurial/keepalive.py Wed Aug 21 22:15:05 2024 -0400
+++ b/mercurial/keepalive.py Fri Jun 28 16:26:06 2024 +0200
@@ -573,19 +573,6 @@
chunks[-1] = chunks[-1][:i]
return b''.join(chunks)
- def readlines(self, sizehint=0):
- total = 0
- list = []
- while True:
- line = self.readline()
- if not line:
- break
- list.append(line)
- total += len(line)
- if sizehint and total >= sizehint:
- break
- return list
-
def readinto(self, dest):
if self._raw_readinto is None:
res = self.read(len(dest))
--- a/mercurial/url.py Wed Aug 21 22:15:05 2024 -0400
+++ b/mercurial/url.py Fri Jun 28 16:26:06 2024 +0200
@@ -499,6 +499,28 @@
return request
+class readlinehandler(urlreq.basehandler):
+ def http_response(self, request, response):
+ class readlineresponse(response.__class__):
+ def readlines(self, sizehint=0):
+ total = 0
+ list = []
+ while True:
+ line = self.readline()
+ if not line:
+ break
+ list.append(line)
+ total += len(line)
+ if sizehint and total >= sizehint:
+ break
+ return list
+
+ response.__class__ = readlineresponse
+ return response
+
+ https_response = http_response
+
+
handlerfuncs = []
@@ -564,6 +586,7 @@
)
handlers.extend([h(ui, passmgr) for h in handlerfuncs])
handlers.append(cookiehandler(ui))
+ handlers.append(readlinehandler())
opener = urlreq.buildopener(*handlers)
# keepalive.py's handlers will populate these attributes if they exist.