mercurial/transaction.py
branchstable
changeset 50301 d89eecf9605e
parent 50300 7ce9862fca7c
child 50302 94a8c354242b
--- a/mercurial/transaction.py	Mon Mar 06 20:16:17 2023 +0100
+++ b/mercurial/transaction.py	Mon Mar 06 22:16:28 2023 +0100
@@ -50,7 +50,7 @@
 ]
 
 
-def cleanup_undo_files(repo):
+def cleanup_undo_files(report, vfsmap):
     """remove "undo" files used by the rollback logic
 
     This is useful to prevent rollback running in situation were it does not
@@ -58,21 +58,21 @@
     """
     backup_entries = []
     undo_files = []
-    vfsmap = repo.vfs_map
+    svfs = vfsmap[b'store']
     try:
-        with repo.svfs(UNDO_BACKUP) as f:
-            backup_entries = read_backup_files(repo.ui.warn, f)
+        with svfs(UNDO_BACKUP) as f:
+            backup_entries = read_backup_files(report, f)
     except OSError as e:
         if e.errno != errno.ENOENT:
             msg = _(b'could not read %s: %s\n')
-            msg %= (repo.svfs.join(UNDO_BACKUP), stringutil.forcebytestr(e))
-            repo.ui.warn(msg)
+            msg %= (svfs.join(UNDO_BACKUP), stringutil.forcebytestr(e))
+            report(msg)
 
     for location, f, backup_path, c in backup_entries:
         if location in vfsmap and backup_path:
             undo_files.append((vfsmap[location], backup_path))
 
-    undo_files.append((repo.svfs, UNDO_BACKUP))
+    undo_files.append((svfs, UNDO_BACKUP))
     for location, undo_path in UNDO_FILES_MAY_NEED_CLEANUP:
         undo_files.append((vfsmap[location], undo_path))
     for undovfs, undofile in undo_files:
@@ -82,7 +82,7 @@
             if e.errno != errno.ENOENT:
                 msg = _(b'error removing %s: %s\n')
                 msg %= (undovfs.join(undofile), stringutil.forcebytestr(e))
-                repo.ui.warn(msg)
+                report(msg)
 
 
 def _playback(