diff mercurial/repair.py @ 50402:c5e93c915ab6

branching: merge stable into default
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 20 Mar 2023 23:16:14 +0100
parents bcf54837241d d89eecf9605e
children 521fec115dad
line wrap: on
line diff
--- a/mercurial/repair.py	Thu Mar 09 13:02:13 2023 -0600
+++ b/mercurial/repair.py	Mon Mar 20 23:16:14 2023 +0100
@@ -7,8 +7,6 @@
 # GNU General Public License version 2 or any later version.
 
 
-import errno
-
 from .i18n import _
 from .node import (
     hex,
@@ -26,11 +24,11 @@
     phases,
     requirements,
     scmutil,
+    transaction,
     util,
 )
 from .utils import (
     hashutil,
-    stringutil,
     urlutil,
 )
 
@@ -270,19 +268,7 @@
                 bmchanges = [(m, repo[newbmtarget].node()) for m in updatebm]
                 repo._bookmarks.applychanges(repo, tr, bmchanges)
 
-            # remove undo files
-            for undovfs, undofile in repo.undofiles():
-                try:
-                    undovfs.unlink(undofile)
-                except OSError as e:
-                    if e.errno != errno.ENOENT:
-                        ui.warn(
-                            _(b'error removing %s: %s\n')
-                            % (
-                                undovfs.join(undofile),
-                                stringutil.forcebytestr(e),
-                            )
-                        )
+            transaction.cleanup_undo_files(repo.ui.warn, repo.vfs_map)
 
         except:  # re-raises
             if backupfile: