comparison mercurial/subrepo.py @ 35587:f2f0a777b2e2

py3: make sure we open the file to write in bytes mode Differential Revision: https://phab.mercurial-scm.org/D1797
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 29 Dec 2017 05:29:57 +0530
parents 35fb3367f72d
children 991f0be9dc39
comparison
equal deleted inserted replaced
35586:fbf1a5d680ea 35587:f2f0a777b2e2
809 ''' 809 '''
810 cachefile = _getstorehashcachename(remotepath) 810 cachefile = _getstorehashcachename(remotepath)
811 with self._repo.lock(): 811 with self._repo.lock():
812 storehash = list(self._calcstorehash(remotepath)) 812 storehash = list(self._calcstorehash(remotepath))
813 vfs = self._cachestorehashvfs 813 vfs = self._cachestorehashvfs
814 vfs.writelines(cachefile, storehash, mode='w', notindexed=True) 814 vfs.writelines(cachefile, storehash, mode='wb', notindexed=True)
815 815
816 def _getctx(self): 816 def _getctx(self):
817 '''fetch the context for this subrepo revision, possibly a workingctx 817 '''fetch the context for this subrepo revision, possibly a workingctx
818 ''' 818 '''
819 if self._ctx.rev() is None: 819 if self._ctx.rev() is None:
839 defpushpath = _abssource(self._repo, True, abort=False) 839 defpushpath = _abssource(self._repo, True, abort=False)
840 addpathconfig('default', defpath) 840 addpathconfig('default', defpath)
841 if defpath != defpushpath: 841 if defpath != defpushpath:
842 addpathconfig('default-push', defpushpath) 842 addpathconfig('default-push', defpushpath)
843 843
844 fp = self._repo.vfs("hgrc", "w", text=True) 844 fp = self._repo.vfs("hgrc", "wb", text=True)
845 try: 845 try:
846 fp.write(''.join(lines)) 846 fp.write(''.join(lines))
847 finally: 847 finally:
848 fp.close() 848 fp.close()
849 849