--- a/mercurial/hg.py Sun Dec 31 02:54:49 2017 -0500
+++ b/mercurial/hg.py Sat Jan 13 13:23:16 2018 +0900
@@ -307,16 +307,13 @@
"""
default = defaultpath or sourcerepo.ui.config('paths', 'default')
if default:
- fp = destrepo.vfs("hgrc", "w", text=True)
- fp.write("[paths]\n")
- fp.write("default = %s\n" % default)
- fp.close()
+ with destrepo.vfs("hgrc", "w", text=True) as fp:
+ fp.write("[paths]\n")
+ fp.write("default = %s\n" % default)
with destrepo.wlock():
if bookmarks:
- fp = destrepo.vfs('shared', 'w')
- fp.write(sharedbookmarks + '\n')
- fp.close()
+ destrepo.vfs.write('shared', sharedbookmarks + '\n')
def _postshareupdate(repo, update, checkout=None):
"""Maybe perform a working directory update after a shared repo is created.