Mercurial > public > mercurial-scm > hg-stable
changeset 52594:7108459cc801
releasenotes: replace a few trivial file reads/writes with `util` functions
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 16 Dec 2024 21:01:02 -0500 |
parents | 92dff84829b3 |
children | 4c7194ed56ab |
files | hgext/releasenotes.py |
diffstat | 1 files changed, 3 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/releasenotes.py Mon Dec 16 20:57:01 2024 -0500 +++ b/hgext/releasenotes.py Mon Dec 16 21:01:02 2024 -0500 @@ -683,15 +683,13 @@ return ui.write(serializenotes(sections, incoming)) try: - with open(file_, 'rb') as fh: - notes = parsereleasenotesfile(sections, fh.read()) + notes = parsereleasenotesfile(sections, util.readfile(file_)) except FileNotFoundError: notes = parsedreleasenotes() notes.merge(ui, incoming) - with open(file_, 'wb') as fh: - fh.write(serializenotes(sections, notes)) + util.writefile(file_, serializenotes(sections, notes)) @command(b'debugparsereleasenotes', norepo=True) @@ -700,8 +698,7 @@ if path == b'-': text = procutil.stdin.read() else: - with open(path, 'rb') as fh: - text = fh.read() + text = util.readfile(path) sections = releasenotessections(ui, repo)