# HG changeset patch # User Yuya Nishihara # Date 1545536360 -32400 # Node ID 3e2c02836420f514c76cecf39a70da79a761e037 # Parent dc56a62735754549c3026c3139a1cc089f21dc52 transaction: do not overwrite atomic-temp files on error Even though the original files can be restored from the backup, it should be better to not write back a temporary file if we know it can be corrupted. diff -r dc56a6273575 -r 3e2c02836420 mercurial/transaction.py --- a/mercurial/transaction.py Thu Jan 03 10:13:34 2019 -0800 +++ b/mercurial/transaction.py Sun Dec 23 12:39:20 2018 +0900 @@ -347,9 +347,13 @@ files.append(vfs(name, 'w', atomictemp=True, checkambig=checkambig)) genfunc(*files) + for f in files: + f.close() + # skip discard() loop since we're sure no open file remains + del files[:] finally: for f in files: - f.close() + f.discard() return any @active