Show More
@@ -26,6 +26,7 b' from . import (' | |||||
26 | phases, |
|
26 | phases, | |
27 | requirements, |
|
27 | requirements, | |
28 | scmutil, |
|
28 | scmutil, | |
|
29 | transaction, | |||
29 | util, |
|
30 | util, | |
30 | ) |
|
31 | ) | |
31 | from .utils import ( |
|
32 | from .utils import ( | |
@@ -113,14 +114,32 b' def _collectbrokencsets(repo, files, str' | |||||
113 | return s |
|
114 | return s | |
114 |
|
115 | |||
115 |
|
116 | |||
|
117 | UNDO_BACKUP = b'undo.backupfiles' | |||
|
118 | ||||
|
119 | ||||
116 | def cleanup_undo_files(repo): |
|
120 | def cleanup_undo_files(repo): | |
117 | """remove "undo" files used by the rollback logic |
|
121 | """remove "undo" files used by the rollback logic | |
118 |
|
122 | |||
119 | This is useful to prevent rollback running in situation were it does not |
|
123 | This is useful to prevent rollback running in situation were it does not | |
120 | make sense. For example after a strip. |
|
124 | make sense. For example after a strip. | |
121 | """ |
|
125 | """ | |
122 | # XXX need to remove the backups themselve too |
|
126 | backup_entries = [] | |
123 | undo_files = [(repo.svfs, b'undo.backupfiles')] |
|
127 | undo_files = [] | |
|
128 | vfsmap = repo.vfs_map | |||
|
129 | try: | |||
|
130 | with repo.svfs(UNDO_BACKUP) as f: | |||
|
131 | backup_entries = transaction.read_backup_files(repo.ui.warn, f) | |||
|
132 | except OSError as e: | |||
|
133 | if e.errno != errno.ENOENT: | |||
|
134 | msg = _(b'could not read %s: %s\n') | |||
|
135 | msg %= (repo.svfs.join(UNDO_BACKUP), stringutil.forcebytestr(e)) | |||
|
136 | repo.ui.warn(msg) | |||
|
137 | ||||
|
138 | for location, f, backup_path, c in backup_entries: | |||
|
139 | if location in vfsmap and backup_path: | |||
|
140 | undo_files.append((vfsmap[location], backup_path)) | |||
|
141 | ||||
|
142 | undo_files.append((repo.svfs, UNDO_BACKUP)) | |||
124 | undo_files.extend(repo.undofiles()) |
|
143 | undo_files.extend(repo.undofiles()) | |
125 | for undovfs, undofile in undo_files: |
|
144 | for undovfs, undofile in undo_files: | |
126 | try: |
|
145 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now