equal
deleted
inserted
replaced
39 |
39 |
40 return _active |
40 return _active |
41 |
41 |
42 |
42 |
43 UNDO_BACKUP = b'undo.backupfiles' |
43 UNDO_BACKUP = b'undo.backupfiles' |
|
44 |
|
45 UNDO_FILES_MAY_NEED_CLEANUP = [ |
|
46 (b'plain', b'undo.desc'), |
|
47 # Always delete undo last to make sure we detect that a clean up is needed if |
|
48 # the process is interrupted. |
|
49 (b'store', b'undo'), |
|
50 ] |
44 |
51 |
45 |
52 |
46 def cleanup_undo_files(repo): |
53 def cleanup_undo_files(repo): |
47 """remove "undo" files used by the rollback logic |
54 """remove "undo" files used by the rollback logic |
48 |
55 |
64 for location, f, backup_path, c in backup_entries: |
71 for location, f, backup_path, c in backup_entries: |
65 if location in vfsmap and backup_path: |
72 if location in vfsmap and backup_path: |
66 undo_files.append((vfsmap[location], backup_path)) |
73 undo_files.append((vfsmap[location], backup_path)) |
67 |
74 |
68 undo_files.append((repo.svfs, UNDO_BACKUP)) |
75 undo_files.append((repo.svfs, UNDO_BACKUP)) |
69 undo_files.extend(repo.undofiles()) |
76 for location, undo_path in UNDO_FILES_MAY_NEED_CLEANUP: |
|
77 undo_files.append((vfsmap[location], undo_path)) |
70 for undovfs, undofile in undo_files: |
78 for undovfs, undofile in undo_files: |
71 try: |
79 try: |
72 undovfs.unlink(undofile) |
80 undovfs.unlink(undofile) |
73 except OSError as e: |
81 except OSError as e: |
74 if e.errno != errno.ENOENT: |
82 if e.errno != errno.ENOENT: |