# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 2017-12-28 23:59:57 # 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 --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -811,7 +811,7 @@ class hgsubrepo(abstractsubrepo): 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 @@ class hgsubrepo(abstractsubrepo): 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: