comparison mercurial/subrepo.py @ 35621:38649e2fbf6c

subrepo: convert EOL of hgrc before writing to bytes IO Follows up f2f0a777b2e2. Text IO is useless on Python 3 as it must be a unicode stream.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 13 Jan 2018 13:28:12 +0900
parents 991f0be9dc39
children 73f51bdb0fea
comparison
equal deleted inserted replaced
35620:545967ec33dc 35621:38649e2fbf6c
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", "wb", text=True) 844 self._repo.vfs.write('hgrc', util.tonativeeol(''.join(lines)))
845 try:
846 fp.write(''.join(lines))
847 finally:
848 fp.close()
849 845
850 @annotatesubrepoerror 846 @annotatesubrepoerror
851 def add(self, ui, match, prefix, explicitonly, **opts): 847 def add(self, ui, match, prefix, explicitonly, **opts):
852 return cmdutil.add(ui, self._repo, match, 848 return cmdutil.add(ui, self._repo, match,
853 self.wvfs.reljoin(prefix, self._path), 849 self.wvfs.reljoin(prefix, self._path),