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