Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hg.py @ 33713:6294654453ee
py3: use bytes IO to write sample hgrc
Unicode sucks. Stop using Text IO and manually convert line endings.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 03 Aug 2017 00:45:02 +0900 |
parents | 071732d9c210 |
children | 0fa781320203 |
line wrap: on
line diff
--- a/mercurial/hg.py Fri Aug 04 08:15:10 2017 +0200 +++ b/mercurial/hg.py Thu Aug 03 00:45:02 2017 +0900 @@ -641,11 +641,11 @@ destrepo = destpeer.local() if destrepo: template = uimod.samplehgrcs['cloned'] - fp = destrepo.vfs("hgrc", "w", text=True) + fp = destrepo.vfs("hgrc", "wb") u = util.url(abspath) u.passwd = None - defaulturl = str(u) - fp.write(template % defaulturl) + defaulturl = bytes(u) + fp.write(util.tonativeeol(template % defaulturl)) fp.close() destrepo.ui.setconfig('paths', 'default', defaulturl, 'clone')