--- a/mercurial/streamclone.py Tue Feb 18 17:21:42 2025 +0100
+++ b/mercurial/streamclone.py Wed Feb 19 01:13:00 2025 +0100
@@ -1544,11 +1544,14 @@
def _write_files(info: Iterable[FileInfoT]):
"""write files from parsed data"""
+ io_flags = os.O_WRONLY | os.O_CREAT
+ if pycompat.iswindows:
+ io_flags |= os.O_BINARY
for path, mode, data in info:
if mode is None:
- fd = os.open(path, os.O_WRONLY | os.O_CREAT)
+ fd = os.open(path, io_flags)
else:
- fd = os.open(path, os.O_WRONLY | os.O_CREAT, mode=mode)
+ fd = os.open(path, io_flags, mode=mode)
try:
for chunk in data:
written = os.write(fd, chunk)