--- a/mercurial/transaction.py Mon Mar 06 21:03:45 2023 +0100
+++ b/mercurial/transaction.py Mon Mar 06 20:16:17 2023 +0100
@@ -42,6 +42,13 @@
UNDO_BACKUP = b'undo.backupfiles'
+UNDO_FILES_MAY_NEED_CLEANUP = [
+ (b'plain', b'undo.desc'),
+ # Always delete undo last to make sure we detect that a clean up is needed if
+ # the process is interrupted.
+ (b'store', b'undo'),
+]
+
def cleanup_undo_files(repo):
"""remove "undo" files used by the rollback logic
@@ -66,7 +73,8 @@
undo_files.append((vfsmap[location], backup_path))
undo_files.append((repo.svfs, UNDO_BACKUP))
- undo_files.extend(repo.undofiles())
+ for location, undo_path in UNDO_FILES_MAY_NEED_CLEANUP:
+ undo_files.append((vfsmap[location], undo_path))
for undovfs, undofile in undo_files:
try:
undovfs.unlink(undofile)