equal
deleted
inserted
replaced
218 primaryactions = set() |
218 primaryactions = set() |
219 secondaryactions = set() |
219 secondaryactions = set() |
220 tertiaryactions = set() |
220 tertiaryactions = set() |
221 internalactions = set() |
221 internalactions = set() |
222 |
222 |
223 def geteditcomment(first, last): |
223 def geteditcomment(ui, first, last): |
224 """ construct the editor comment |
224 """ construct the editor comment |
225 The comment includes:: |
225 The comment includes:: |
226 - an intro |
226 - an intro |
227 - sorted primary commands |
227 - sorted primary commands |
228 - sorted short commands |
228 - sorted short commands |
229 - sorted long commands |
229 - sorted long commands |
|
230 - additional hints |
230 |
231 |
231 Commands are only included once. |
232 Commands are only included once. |
232 """ |
233 """ |
233 intro = _("""Edit history between %s and %s |
234 intro = _("""Edit history between %s and %s |
234 |
235 |
253 sorted(tertiaryactions) |
254 sorted(tertiaryactions) |
254 ): |
255 ): |
255 addverb(v) |
256 addverb(v) |
256 actions.append('') |
257 actions.append('') |
257 |
258 |
258 return ''.join(['# %s\n' % l if l else '#\n' |
259 hints = [] |
259 for l in ((intro % (first, last)).split('\n')) + actions]) |
260 if ui.configbool('histedit', 'dropmissing'): |
|
261 hints.append("Deleting a changeset from the list " |
|
262 "will DISCARD it from the edited history!") |
|
263 |
|
264 lines = (intro % (first, last)).split('\n') + actions + hints |
|
265 |
|
266 return ''.join(['# %s\n' % l if l else '#\n' for l in lines]) |
260 |
267 |
261 class histeditstate(object): |
268 class histeditstate(object): |
262 def __init__(self, repo, parentctxnode=None, actions=None, keep=None, |
269 def __init__(self, repo, parentctxnode=None, actions=None, keep=None, |
263 topmost=None, replacements=None, lock=None, wlock=None): |
270 topmost=None, replacements=None, lock=None, wlock=None): |
264 self.repo = repo |
271 self.repo = repo |
1191 state.clear() |
1198 state.clear() |
1192 |
1199 |
1193 def _edithisteditplan(ui, repo, state, rules): |
1200 def _edithisteditplan(ui, repo, state, rules): |
1194 state.read() |
1201 state.read() |
1195 if not rules: |
1202 if not rules: |
1196 comment = geteditcomment(node.short(state.parentctxnode), |
1203 comment = geteditcomment(ui, |
|
1204 node.short(state.parentctxnode), |
1197 node.short(state.topmost)) |
1205 node.short(state.topmost)) |
1198 rules = ruleeditor(repo, ui, state.actions, comment) |
1206 rules = ruleeditor(repo, ui, state.actions, comment) |
1199 else: |
1207 else: |
1200 rules = _readfile(rules) |
1208 rules = _readfile(rules) |
1201 actions = parserules(rules, state) |
1209 actions = parserules(rules, state) |
1232 raise error.Abort(_('%s is not an ancestor of working directory') % |
1240 raise error.Abort(_('%s is not an ancestor of working directory') % |
1233 node.short(root)) |
1241 node.short(root)) |
1234 |
1242 |
1235 ctxs = [repo[r] for r in revs] |
1243 ctxs = [repo[r] for r in revs] |
1236 if not rules: |
1244 if not rules: |
1237 comment = geteditcomment(node.short(root), node.short(topmost)) |
1245 comment = geteditcomment(ui, node.short(root), node.short(topmost)) |
1238 actions = [pick(state, r) for r in revs] |
1246 actions = [pick(state, r) for r in revs] |
1239 rules = ruleeditor(repo, ui, actions, comment) |
1247 rules = ruleeditor(repo, ui, actions, comment) |
1240 else: |
1248 else: |
1241 rules = _readfile(rules) |
1249 rules = _readfile(rules) |
1242 actions = parserules(rules, state) |
1250 actions = parserules(rules, state) |