Patchwork [2,of,7] clone: use utility function to write hgrc

login
register
mail settings
Submitter Yuya Nishihara
Date Jan. 13, 2018, 5:02 a.m.
Message ID <f5558d75ef44a2db6413.1515819773@mimosa>
Download mbox | patch
Permalink /patch/26716/
State Accepted
Headers show

Comments

Yuya Nishihara - Jan. 13, 2018, 5:02 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1515817457 -32400
#      Sat Jan 13 13:24:17 2018 +0900
# Node ID f5558d75ef44a2db64131b4e5bca98102542f13b
# Parent  2eeaf96c20fce19c8edccf4936aceee4ce651de9
clone: use utility function to write hgrc

Patch

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -681,13 +681,10 @@  def clone(ui, peeropts, source, dest=Non
         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'):