# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1514505597 -19800 # Node ID f2f0a777b2e28dceb003ea9ce05412b9f6013d06 # Parent fbf1a5d680ea25c56a0f29b8e85ff5dc32713cd1 py3: make sure we open the file to write in bytes mode Differential Revision: https://phab.mercurial-scm.org/D1797 diff -r fbf1a5d680ea -r f2f0a777b2e2 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: