diff mercurial/transaction.py @ 50290:92734603e33e stable

undo-files: clean existing files up before writing new one the in the initial design of journal/undo interaction, ages ago, new file always overwrote previous files. This is no longer the case for a long while, so it is time to properly clean things up before writing new ones. Otherwise, inconsistent "undo" state might exist on disk, leading `hg rollback` to misbehave (more that intended).
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 06 Mar 2023 22:16:43 +0100
parents 94a8c354242b
children 862969b6c359
line wrap: on
line diff
--- a/mercurial/transaction.py	Tue Mar 07 03:31:21 2023 +0100
+++ b/mercurial/transaction.py	Mon Mar 06 22:16:43 2023 +0100
@@ -690,6 +690,11 @@
         """write transaction data for possible future undo call"""
         if self._undoname is None:
             return
+        cleanup_undo_files(
+            self._report,
+            self._vfsmap,
+            undo_prefix=self._undoname,
+        )
 
         def undoname(fn: bytes) -> bytes:
             base, name = os.path.split(fn)