##// END OF EJS Templates
undo-files: no longer pass the `repo` to `cleanup_undo_files`...
marmoute -
r51196:d89eecf9 stable
parent child Browse files
Show More
@@ -294,7 +294,7 b' def handlechangegroup_widen(op, inpart):'
294 finally:
294 finally:
295 f.close()
295 f.close()
296
296
297 transaction.cleanup_undo_files(repo)
297 transaction.cleanup_undo_files(repo.ui.warn, repo.vfs_map)
298
298
299 # Remove partial backup only if there were no exceptions
299 # Remove partial backup only if there were no exceptions
300 op._widen_uninterr.__exit__(None, None, None)
300 op._widen_uninterr.__exit__(None, None, None)
@@ -259,7 +259,7 b' def strip(ui, repo, nodelist, backup=Tru'
259 bmchanges = [(m, repo[newbmtarget].node()) for m in updatebm]
259 bmchanges = [(m, repo[newbmtarget].node()) for m in updatebm]
260 repo._bookmarks.applychanges(repo, tr, bmchanges)
260 repo._bookmarks.applychanges(repo, tr, bmchanges)
261
261
262 transaction.cleanup_undo_files(repo)
262 transaction.cleanup_undo_files(repo.ui.warn, repo.vfs_map)
263
263
264 except: # re-raises
264 except: # re-raises
265 if backupfile:
265 if backupfile:
@@ -932,4 +932,4 b' def local_copy(src_repo, dest_repo):'
932 dest_repo.store.write(tr)
932 dest_repo.store.write(tr)
933
933
934 # clean up transaction file as they do not make sense
934 # clean up transaction file as they do not make sense
935 transaction.cleanup_undo_files(dest_repo)
935 transaction.cleanup_undo_files(dest_repo.ui.warn, dest_repo.vfs_map)
@@ -50,7 +50,7 b' UNDO_FILES_MAY_NEED_CLEANUP = ['
50 ]
50 ]
51
51
52
52
53 def cleanup_undo_files(repo):
53 def cleanup_undo_files(report, vfsmap):
54 """remove "undo" files used by the rollback logic
54 """remove "undo" files used by the rollback logic
55
55
56 This is useful to prevent rollback running in situation were it does not
56 This is useful to prevent rollback running in situation were it does not
@@ -58,21 +58,21 b' def cleanup_undo_files(repo):'
58 """
58 """
59 backup_entries = []
59 backup_entries = []
60 undo_files = []
60 undo_files = []
61 vfsmap = repo.vfs_map
61 svfs = vfsmap[b'store']
62 try:
62 try:
63 with repo.svfs(UNDO_BACKUP) as f:
63 with svfs(UNDO_BACKUP) as f:
64 backup_entries = read_backup_files(repo.ui.warn, f)
64 backup_entries = read_backup_files(report, f)
65 except OSError as e:
65 except OSError as e:
66 if e.errno != errno.ENOENT:
66 if e.errno != errno.ENOENT:
67 msg = _(b'could not read %s: %s\n')
67 msg = _(b'could not read %s: %s\n')
68 msg %= (repo.svfs.join(UNDO_BACKUP), stringutil.forcebytestr(e))
68 msg %= (svfs.join(UNDO_BACKUP), stringutil.forcebytestr(e))
69 repo.ui.warn(msg)
69 report(msg)
70
70
71 for location, f, backup_path, c in backup_entries:
71 for location, f, backup_path, c in backup_entries:
72 if location in vfsmap and backup_path:
72 if location in vfsmap and backup_path:
73 undo_files.append((vfsmap[location], backup_path))
73 undo_files.append((vfsmap[location], backup_path))
74
74
75 undo_files.append((repo.svfs, UNDO_BACKUP))
75 undo_files.append((svfs, UNDO_BACKUP))
76 for location, undo_path in UNDO_FILES_MAY_NEED_CLEANUP:
76 for location, undo_path in UNDO_FILES_MAY_NEED_CLEANUP:
77 undo_files.append((vfsmap[location], undo_path))
77 undo_files.append((vfsmap[location], undo_path))
78 for undovfs, undofile in undo_files:
78 for undovfs, undofile in undo_files:
@@ -82,7 +82,7 b' def cleanup_undo_files(repo):'
82 if e.errno != errno.ENOENT:
82 if e.errno != errno.ENOENT:
83 msg = _(b'error removing %s: %s\n')
83 msg = _(b'error removing %s: %s\n')
84 msg %= (undovfs.join(undofile), stringutil.forcebytestr(e))
84 msg %= (undovfs.join(undofile), stringutil.forcebytestr(e))
85 repo.ui.warn(msg)
85 report(msg)
86
86
87
87
88 def _playback(
88 def _playback(
General Comments 0
You need to be logged in to leave comments. Login now