histedit: modernize write of histedit-last-edit file
authorAugie Fackler <augie@google.com>
Tue, 13 Feb 2018 17:25:43 -0500
changeset 36168 be73fa5b42d3
parent 36167 73621823a1ac
child 36169 0ea86f70da8e
histedit: modernize write of histedit-last-edit file Differential Revision: https://phab.mercurial-scm.org/D2241
hgext/histedit.py
--- a/hgext/histedit.py	Tue Feb 13 17:25:25 2018 -0500
+++ b/hgext/histedit.py	Tue Feb 13 17:25:43 2018 -0500
@@ -1415,9 +1415,8 @@
     # Save edit rules in .hg/histedit-last-edit.txt in case
     # the user needs to ask for help after something
     # surprising happens.
-    f = open(repo.vfs.join('histedit-last-edit.txt'), 'w')
-    f.write(rules)
-    f.close()
+    with repo.vfs('histedit-last-edit.txt', 'wb') as f:
+        f.write(rules)
 
     return rules