changeset 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 545967ec33dc
children e925f33ac088
files mercurial/subrepo.py
diffstat 1 files changed, 1 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/subrepo.py	Sat Jan 13 13:24:17 2018 +0900
+++ b/mercurial/subrepo.py	Sat Jan 13 13:28:12 2018 +0900
@@ -841,11 +841,7 @@
             if defpath != defpushpath:
                 addpathconfig('default-push', defpushpath)
 
-            fp = self._repo.vfs("hgrc", "wb", text=True)
-            try:
-                fp.write(''.join(lines))
-            finally:
-                fp.close()
+            self._repo.vfs.write('hgrc', util.tonativeeol(''.join(lines)))
 
     @annotatesubrepoerror
     def add(self, ui, match, prefix, explicitonly, **opts):