# HG changeset patch # User Pierre-Yves David # Date 1678104136 -3600 # Node ID 48b90d18e9de71e6d1ce3df6c056602ffa56be94 # Parent 8011017629be0fa43b185c9b36a4d99e55984e8d undo-files: use the cleanup function in narrow Lets use the same code, so that we can fix things only once. diff -r 8011017629be -r 48b90d18e9de hgext/narrow/narrowbundle2.py --- 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)