Mercurial > public > mercurial-scm > hg-stable
diff mercurial/transaction.py @ 50288:d89eecf9605e stable
undo-files: no longer pass the `repo` to `cleanup_undo_files`
As foretold in the previous changesets, we no longer need a full repository
object here.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 06 Mar 2023 22:16:28 +0100 |
parents | 7ce9862fca7c |
children | 94a8c354242b |
line wrap: on
line diff
--- a/mercurial/transaction.py Mon Mar 06 20:16:17 2023 +0100 +++ b/mercurial/transaction.py Mon Mar 06 22:16:28 2023 +0100 @@ -50,7 +50,7 @@ ] -def cleanup_undo_files(repo): +def cleanup_undo_files(report, vfsmap): """remove "undo" files used by the rollback logic This is useful to prevent rollback running in situation were it does not @@ -58,21 +58,21 @@ """ backup_entries = [] undo_files = [] - vfsmap = repo.vfs_map + svfs = vfsmap[b'store'] try: - with repo.svfs(UNDO_BACKUP) as f: - backup_entries = read_backup_files(repo.ui.warn, f) + with svfs(UNDO_BACKUP) as f: + backup_entries = read_backup_files(report, f) except OSError as e: if e.errno != errno.ENOENT: msg = _(b'could not read %s: %s\n') - msg %= (repo.svfs.join(UNDO_BACKUP), stringutil.forcebytestr(e)) - repo.ui.warn(msg) + msg %= (svfs.join(UNDO_BACKUP), stringutil.forcebytestr(e)) + report(msg) for location, f, backup_path, c in backup_entries: if location in vfsmap and backup_path: undo_files.append((vfsmap[location], backup_path)) - undo_files.append((repo.svfs, UNDO_BACKUP)) + undo_files.append((svfs, UNDO_BACKUP)) for location, undo_path in UNDO_FILES_MAY_NEED_CLEANUP: undo_files.append((vfsmap[location], undo_path)) for undovfs, undofile in undo_files: @@ -82,7 +82,7 @@ if e.errno != errno.ENOENT: msg = _(b'error removing %s: %s\n') msg %= (undovfs.join(undofile), stringutil.forcebytestr(e)) - repo.ui.warn(msg) + report(msg) def _playback(