changeset 35623:f56f8abbeaf1

largefiles: convert EOL of hgrc before appending to bytes IO 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:33:55 +0900
parents e925f33ac088
children 188b1371d1ed
files hgext/largefiles/overrides.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Sat Jan 13 13:31:27 2018 +0900
+++ b/hgext/largefiles/overrides.py	Sat Jan 13 13:33:55 2018 +0900
@@ -888,8 +888,8 @@
 
         # If largefiles is required for this repo, permanently enable it locally
         if 'largefiles' in repo.requirements:
-            with repo.vfs('hgrc', 'a', text=True) as fp:
-                fp.write('\n[extensions]\nlargefiles=\n')
+            repo.vfs.append('hgrc',
+                            util.tonativeeol('\n[extensions]\nlargefiles=\n'))
 
         # Caching is implicitly limited to 'rev' option, since the dest repo was
         # truncated at that point.  The user may expect a download count with
@@ -907,8 +907,8 @@
 
     # If largefiles is required for this repo, permanently enable it locally
     if 'largefiles' in destrepo.requirements:
-        with destrepo.vfs('hgrc', 'a+', text=True) as fp:
-            fp.write('\n[extensions]\nlargefiles=\n')
+        destrepo.vfs.append('hgrc',
+                            util.tonativeeol('\n[extensions]\nlargefiles=\n'))
 
 def overriderebase(orig, ui, repo, **opts):
     if not util.safehasattr(repo, '_largefilesenabled'):