clone: use utility function to write hgrc
authorYuya Nishihara <yuya@tcha.org>
Sat, 13 Jan 2018 13:24:17 +0900
changeset 35620 545967ec33dc
parent 35619 c751b9fdbc40
child 35621 38649e2fbf6c
clone: use utility function to write hgrc
mercurial/hg.py
--- 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'):