[PATCH 4 of 7] share: convert EOL of hgrc before writing to bytes IO
Yuya Nishihara
yuya at tcha.org
Sat Jan 13 00:02:55 EST 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1515817887 -32400
# Sat Jan 13 13:31:27 2018 +0900
# Node ID c4ecde5fbf1e40f0c918c9b4f6c1215b2cbebb7c
# Parent 41f5fc043698f6c8ff042ebb7d380f76a68a006b
share: convert EOL of hgrc before writing to bytes IO
Text IO is useless on Python 3 as it must be a unicode stream.
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -307,9 +307,9 @@ def postshare(sourcerepo, destrepo, book
"""
default = defaultpath or sourcerepo.ui.config('paths', 'default')
if default:
- with destrepo.vfs("hgrc", "w", text=True) as fp:
- fp.write("[paths]\n")
- fp.write("default = %s\n" % default)
+ template = ('[paths]\n'
+ 'default = %s\n')
+ destrepo.vfs.write('hgrc', util.tonativeeol(template % default))
with destrepo.wlock():
if bookmarks:
More information about the Mercurial-devel
mailing list