--- a/mercurial/commands.py Thu Apr 12 23:06:27 2018 -0700
+++ b/mercurial/commands.py Thu Apr 12 23:14:38 2018 -0700
@@ -3089,11 +3089,10 @@
haspatch = False
for hunk in patch.split(patchfile):
- patchdata = patch.extract(ui, hunk)
-
- msg, node, rej = cmdutil.tryimportone(ui, repo, patchdata,
- parents, opts,
- msgs, hg.clean)
+ with patch.extract(ui, hunk) as patchdata:
+ msg, node, rej = cmdutil.tryimportone(ui, repo, patchdata,
+ parents, opts,
+ msgs, hg.clean)
if msg:
haspatch = True
ui.note(msg + '\n')