changeset 35620:545967ec33dc

clone: use utility function to write hgrc
author Yuya Nishihara <yuya@tcha.org>
date Sat, 13 Jan 2018 13:24:17 +0900
parents c751b9fdbc40
children 38649e2fbf6c
files mercurial/hg.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Sat Jan 13 13:23:16 2018 +0900
+++ b/mercurial/hg.py	Sat Jan 13 13:24:17 2018 +0900
@@ -681,13 +681,10 @@
         destrepo = destpeer.local()
         if destrepo:
             template = uimod.samplehgrcs['cloned']
-            fp = destrepo.vfs("hgrc", "wb")
             u = util.url(abspath)
             u.passwd = None
             defaulturl = bytes(u)
-            fp.write(util.tonativeeol(template % defaulturl))
-            fp.close()
-
+            destrepo.vfs.write('hgrc', util.tonativeeol(template % defaulturl))
             destrepo.ui.setconfig('paths', 'default', defaulturl, 'clone')
 
             if ui.configbool('experimental', 'remotenames'):