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.
--- 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