# HG changeset patch # User Pierre-Yves David # Date 1678104343 -3600 # Node ID 97e91001a4e08231e221fedc862517f973e51509 # Parent cd680b45a920b109211367767746aaccba4ed350 undo-files: use the cleanup function in streamclone Lets use the same code, so that we can fix things only once. diff -r cd680b45a920 -r 97e91001a4e0 mercurial/streamclone.py --- 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)