diff -r c3970be8deca -r 2f47703c5489 mercurial/context.py --- a/mercurial/context.py Sat Oct 13 09:45:49 2018 -0400 +++ b/mercurial/context.py Sat Oct 13 08:54:31 2018 -0400 @@ -2433,5 +2433,5 @@ def write(self, data, flags, **kwargs): assert not flags - with open(self._path, "w") as f: + with open(self._path, "wb") as f: f.write(data)