changeset 36206:be73fa5b42d3

histedit: modernize write of histedit-last-edit file Differential Revision: https://phab.mercurial-scm.org/D2241
author Augie Fackler <augie@google.com>
date Tue, 13 Feb 2018 17:25:43 -0500
parents 73621823a1ac
children 0ea86f70da8e
files hgext/histedit.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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