Patchwork D2241: histedit: modernize write of histedit-last-edit file

login
register
mail settings
Submitter phabricator
Date Feb. 13, 2018, 11:14 p.m.
Message ID <differential-rev-PHID-DREV-qgrrtzoko4s33fj4t46c-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27858/
State Superseded
Headers show

Comments

phabricator - Feb. 13, 2018, 11:14 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2241

AFFECTED FILES
  hgext/histedit.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -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