diff -r b53f2f5a18de -r f20feb496d3c mercurial/filemerge.py --- a/mercurial/filemerge.py Mon Feb 14 22:04:50 2022 -0800 +++ b/mercurial/filemerge.py Mon Feb 14 22:11:50 2022 -0800 @@ -944,8 +944,8 @@ d = localpath if localpath is not None: f, d = maketempfrompath(b"local", d) - with open(localpath, b'rb') as src: - f.write(src.read()) + data = util.readfile(localpath) + f.write(data) f.close() try: