--- a/mercurial/subrepo.py Mon Dec 16 21:50:24 2024 -0500
+++ b/mercurial/subrepo.py Tue Dec 17 16:02:58 2024 -0500
@@ -1966,11 +1966,11 @@
# TODO: add support for non-plain formatter (see cmdutil.cat())
for f in match.files():
output = self._gitcommand([b"show", b"%s:%s" % (rev, f)])
- fp = cmdutil.makefileobj(
+ with cmdutil.makefileobj(
self._ctx, fntemplate, pathname=self.wvfs.reljoin(prefix, f)
- )
- fp.write(output)
- fp.close()
+ ) as fp:
+ fp.write(output)
+
return 0
@annotatesubrepoerror