Mercurial > public > mercurial-scm > hg-stable
changeset 52587:1a7bc756e3f2
histedit: don't leak a file descriptor when reading the rules file
Since we're already importing the `util` module, use its `readfile()` method
that had the same code, with a context manager.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 16 Dec 2024 20:28:58 -0500 |
parents | 058b051bc44f |
children | 5dcf40af7c2d |
files | hgext/histedit.py |
diffstat | 1 files changed, 1 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/histedit.py Mon Dec 16 20:24:56 2024 -0500 +++ b/hgext/histedit.py Mon Dec 16 20:28:58 2024 -0500 @@ -1950,8 +1950,7 @@ with ui.timeblockedsection(b'histedit'): return ui.fin.read() else: - with open(path, 'rb') as f: - return f.read() + return util.readfile(path) def _validateargs(ui, repo, freeargs, opts, goal, rules, revs):