py3: make sure we open the file to write in bytes mode
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 29 Dec 2017 05:29:57 +0530
changeset 35587 f2f0a777b2e2
parent 35586 fbf1a5d680ea
child 35588 dadbf213a765
py3: make sure we open the file to write in bytes mode Differential Revision: https://phab.mercurial-scm.org/D1797
mercurial/subrepo.py
--- a/mercurial/subrepo.py	Fri Dec 29 05:47:17 2017 +0530
+++ b/mercurial/subrepo.py	Fri Dec 29 05:29:57 2017 +0530
@@ -811,7 +811,7 @@
         with self._repo.lock():
             storehash = list(self._calcstorehash(remotepath))
             vfs = self._cachestorehashvfs
-            vfs.writelines(cachefile, storehash, mode='w', notindexed=True)
+            vfs.writelines(cachefile, storehash, mode='wb', notindexed=True)
 
     def _getctx(self):
         '''fetch the context for this subrepo revision, possibly a workingctx
@@ -841,7 +841,7 @@
             if defpath != defpushpath:
                 addpathconfig('default-push', defpushpath)
 
-            fp = self._repo.vfs("hgrc", "w", text=True)
+            fp = self._repo.vfs("hgrc", "wb", text=True)
             try:
                 fp.write(''.join(lines))
             finally: