mercurial/streamclone.py
changeset 50666 60f9602b413e
parent 50640 9caa860dcbec
child 50706 0452af304808
--- a/mercurial/streamclone.py	Wed May 31 18:08:56 2023 +0100
+++ b/mercurial/streamclone.py	Wed Mar 08 14:23:43 2023 +0100
@@ -428,7 +428,16 @@
             with repo.svfs.backgroundclosing(repo.ui, expectedcount=filecount):
                 for i in range(filecount):
                     # XXX doesn't support '\n' or '\r' in filenames
-                    l = fp.readline()
+                    if util.safehasattr(fp, 'readline'):
+                        l = fp.readline()
+                    else:
+                        # inline clonebundles use a chunkbuffer, so no readline
+                        # --> this should be small anyway, the first line
+                        # only contains the size of the bundle
+                        l_buf = []
+                        while not (l_buf and l_buf[-1] == b'\n'):
+                            l_buf.append(fp.read(1))
+                        l = b''.join(l_buf)
                     try:
                         name, size = l.split(b'\0', 1)
                         size = int(size)