##// END OF EJS Templates
share: use context manager or utility function to write file
Yuya Nishihara -
r35637:c751b9fd default
parent child Browse files
Show More
@@ -307,16 +307,13 b' def postshare(sourcerepo, destrepo, book'
307 """
307 """
308 default = defaultpath or sourcerepo.ui.config('paths', 'default')
308 default = defaultpath or sourcerepo.ui.config('paths', 'default')
309 if default:
309 if default:
310 fp = destrepo.vfs("hgrc", "w", text=True)
310 with destrepo.vfs("hgrc", "w", text=True) as fp:
311 fp.write("[paths]\n")
311 fp.write("[paths]\n")
312 fp.write("default = %s\n" % default)
312 fp.write("default = %s\n" % default)
313 fp.close()
314
313
315 with destrepo.wlock():
314 with destrepo.wlock():
316 if bookmarks:
315 if bookmarks:
317 fp = destrepo.vfs('shared', 'w')
316 destrepo.vfs.write('shared', sharedbookmarks + '\n')
318 fp.write(sharedbookmarks + '\n')
319 fp.close()
320
317
321 def _postshareupdate(repo, update, checkout=None):
318 def _postshareupdate(repo, update, checkout=None):
322 """Maybe perform a working directory update after a shared repo is created.
319 """Maybe perform a working directory update after a shared repo is created.
General Comments 0
You need to be logged in to leave comments. Login now