changeset 50277:48b90d18e9de stable

undo-files: use the cleanup function in narrow 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:02:16 +0100
parents 8011017629be
children cd680b45a920
files hgext/narrow/narrowbundle2.py
diffstat 1 files changed, 1 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/narrow/narrowbundle2.py	Mon Mar 06 12:57:46 2023 +0100
+++ b/hgext/narrow/narrowbundle2.py	Mon Mar 06 13:02:16 2023 +0100
@@ -6,7 +6,6 @@
 # GNU General Public License version 2 or any later version.
 
 
-import errno
 import struct
 
 from mercurial.i18n import _
@@ -23,7 +22,6 @@
     util,
     wireprototypes,
 )
-from mercurial.utils import stringutil
 
 _NARROWACL_SECTION = b'narrowacl'
 _CHANGESPECPART = b'narrow:changespec'
@@ -295,16 +293,7 @@
     finally:
         f.close()
 
-    # 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))
-                )
+    repair.cleanup_undo_files(repo)
 
     # Remove partial backup only if there were no exceptions
     op._widen_uninterr.__exit__(None, None, None)