Mercurial > hg
comparison hgext/histedit.py @ 31526:9d55494bd0db
histedit: use safecleanupnode in _finishhistedit
This simplifies code a lot.
author | Jun Wu <quark@fb.com> |
---|---|
date | Mon, 13 Mar 2017 22:19:06 -0700 |
parents | 8633d3e21443 |
children | 6f0b7475cf9a |
comparison
equal
deleted
inserted
replaced
31525:8633d3e21443 | 31526:9d55494bd0db |
---|---|
1167 if len(succs) > 1: | 1167 if len(succs) > 1: |
1168 m = 'histedit: %s' | 1168 m = 'histedit: %s' |
1169 for n in succs[1:]: | 1169 for n in succs[1:]: |
1170 ui.debug(m % node.short(n)) | 1170 ui.debug(m % node.short(n)) |
1171 | 1171 |
1172 supportsmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt) | 1172 safecleanupnode(ui, repo, 'temp', tmpnodes) |
1173 if supportsmarkers: | |
1174 # Only create markers if the temp nodes weren't already removed. | |
1175 obsolete.createmarkers(repo, ((repo[t],()) for t in sorted(tmpnodes) | |
1176 if t in repo)) | |
1177 else: | |
1178 cleanupnode(ui, repo, 'temp', tmpnodes) | |
1179 | 1173 |
1180 if not state.keep: | 1174 if not state.keep: |
1181 if mapping: | 1175 if mapping: |
1182 movebookmarks(ui, repo, mapping, state.topmost, ntm) | 1176 movebookmarks(ui, repo, mapping, state.topmost, ntm) |
1183 # TODO update mq state | 1177 # TODO update mq state |
1184 if supportsmarkers: | 1178 safecleanupnode(ui, repo, 'replaced', mapping) |
1185 markers = [] | |
1186 # sort by revision number because it sound "right" | |
1187 for prec in sorted(mapping, key=repo.changelog.rev): | |
1188 succs = mapping[prec] | |
1189 markers.append((repo[prec], | |
1190 tuple(repo[s] for s in succs))) | |
1191 if markers: | |
1192 obsolete.createmarkers(repo, markers) | |
1193 else: | |
1194 cleanupnode(ui, repo, 'replaced', mapping) | |
1195 | 1179 |
1196 state.clear() | 1180 state.clear() |
1197 if os.path.exists(repo.sjoin('undo')): | 1181 if os.path.exists(repo.sjoin('undo')): |
1198 os.unlink(repo.sjoin('undo')) | 1182 os.unlink(repo.sjoin('undo')) |
1199 if repo.vfs.exists('histedit-last-edit.txt'): | 1183 if repo.vfs.exists('histedit-last-edit.txt'): |