changeset 50279:97e91001a4e0 stable

undo-files: use the cleanup function in streamclone Lets use the same code, so that we can fix things only once.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 06 Mar 2023 13:05:43 +0100
parents cd680b45a920
children 5e568d70f54d
files mercurial/streamclone.py
diffstat 1 files changed, 2 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/streamclone.py	Mon Mar 06 13:05:08 2023 +0100
+++ b/mercurial/streamclone.py	Mon Mar 06 13:05:43 2023 +0100
@@ -7,7 +7,6 @@
 
 
 import contextlib
-import errno
 import os
 import struct
 
@@ -21,6 +20,7 @@
     narrowspec,
     phases,
     pycompat,
+    repair,
     requirements as requirementsmod,
     scmutil,
     store,
@@ -29,9 +29,6 @@
 from .revlogutils import (
     nodemap,
 )
-from .utils import (
-    stringutil,
-)
 
 
 def new_stream_clone_requirements(default_requirements, streamed_requirements):
@@ -935,15 +932,4 @@
             dest_repo.store.write(tr)
 
         # clean up transaction file as they do not make sense
-        undo_files = [(dest_repo.svfs, b'undo.backupfiles')]
-        undo_files.extend(dest_repo.undofiles())
-        for undovfs, undofile in undo_files:
-            try:
-                undovfs.unlink(undofile)
-            except OSError as e:
-                if e.errno != errno.ENOENT:
-                    msg = _(b'error removing %s: %s\n')
-                    path = undovfs.join(undofile)
-                    e_msg = stringutil.forcebytestr(e)
-                    msg %= (path, e_msg)
-                    dest_repo.ui.warn(msg)
+        repair.cleanup_undo_files(dest_repo)