gpg: use a context manager to write `.hgsigs`
authorMatt Harbison <matt_harbison@yahoo.com>
Sun, 20 Aug 2023 16:20:56 -0400
changeset 50901 bbaac3a222bb
parent 50900 b3ac579bde41
child 50902 7e6cd8472dc8
gpg: use a context manager to write `.hgsigs`
hgext/gpg.py
--- a/hgext/gpg.py	Sun Aug 20 16:19:41 2023 -0400
+++ b/hgext/gpg.py	Sun Aug 20 16:20:56 2023 -0400
@@ -348,9 +348,8 @@
                 hint=_(b"please commit .hgsigs manually"),
             )
 
-    sigsfile = repo.wvfs(b".hgsigs", b"ab")
-    sigsfile.write(sigmessage)
-    sigsfile.close()
+    with repo.wvfs(b".hgsigs", b"ab") as sigsfile:
+        sigsfile.write(sigmessage)
 
     if b'.hgsigs' not in repo.dirstate:
         with repo.dirstate.changing_files(repo):