##// END OF EJS Templates
histedit: pass state to action functions
David Soria Parra -
r22982:52f10a4d default
parent child Browse files
Show More
@@ -326,7 +326,8 b' def collapse(repo, first, last, commitop'
326 editor=editor)
326 editor=editor)
327 return repo.commitctx(new)
327 return repo.commitctx(new)
328
328
329 def pick(ui, repo, ctx, ha, opts):
329 def pick(ui, state, ha, opts):
330 repo, ctx = state.repo, state.parentctx
330 oldctx = repo[ha]
331 oldctx = repo[ha]
331 if oldctx.parents()[0] == ctx:
332 if oldctx.parents()[0] == ctx:
332 ui.debug('node %s unchanged\n' % ha)
333 ui.debug('node %s unchanged\n' % ha)
@@ -348,7 +349,8 b' def pick(ui, repo, ctx, ha, opts):'
348 return new, [(oldctx.node(), (n,))]
349 return new, [(oldctx.node(), (n,))]
349
350
350
351
351 def edit(ui, repo, ctx, ha, opts):
352 def edit(ui, state, ha, opts):
353 repo, ctx = state.repo, state.parentctx
352 oldctx = repo[ha]
354 oldctx = repo[ha]
353 hg.update(repo, ctx.node())
355 hg.update(repo, ctx.node())
354 applychanges(ui, repo, oldctx, opts)
356 applychanges(ui, repo, oldctx, opts)
@@ -356,12 +358,14 b' def edit(ui, repo, ctx, ha, opts):'
356 _('Make changes as needed, you may commit or record as needed now.\n'
358 _('Make changes as needed, you may commit or record as needed now.\n'
357 'When you are finished, run hg histedit --continue to resume.'))
359 'When you are finished, run hg histedit --continue to resume.'))
358
360
359 def rollup(ui, repo, ctx, ha, opts):
361 def rollup(ui, state, ha, opts):
362 ctx = state.parentctx
360 rollupopts = opts.copy()
363 rollupopts = opts.copy()
361 rollupopts['rollup'] = True
364 rollupopts['rollup'] = True
362 return fold(ui, repo, ctx, ha, rollupopts)
365 return fold(ui, state, ha, rollupopts)
363
366
364 def fold(ui, repo, ctx, ha, opts):
367 def fold(ui, state, ha, opts):
368 repo, ctx = state.repo, state.parentctx
365 oldctx = repo[ha]
369 oldctx = repo[ha]
366 hg.update(repo, ctx.node())
370 hg.update(repo, ctx.node())
367 stats = applychanges(ui, repo, oldctx, opts)
371 stats = applychanges(ui, repo, oldctx, opts)
@@ -417,11 +421,13 b' def finishfold(ui, repo, ctx, oldctx, ne'
417 replacements.append((ich, (n,)))
421 replacements.append((ich, (n,)))
418 return repo[n], replacements
422 return repo[n], replacements
419
423
420 def drop(ui, repo, ctx, ha, opts):
424 def drop(ui, state, ha, opts):
425 repo, ctx = state.repo, state.parentctx
421 return ctx, [(repo[ha].node(), ())]
426 return ctx, [(repo[ha].node(), ())]
422
427
423
428
424 def message(ui, repo, ctx, ha, opts):
429 def message(ui, state, ha, opts):
430 repo, ctx = state.repo, state.parentctx
425 oldctx = repo[ha]
431 oldctx = repo[ha]
426 hg.update(repo, ctx.node())
432 hg.update(repo, ctx.node())
427 stats = applychanges(ui, repo, oldctx, opts)
433 stats = applychanges(ui, repo, oldctx, opts)
@@ -642,8 +648,7 b' def _histedit(ui, repo, *freeargs, **opt'
642 action, ha = state.rules.pop(0)
648 action, ha = state.rules.pop(0)
643 ui.debug('histedit: processing %s %s\n' % (action, ha))
649 ui.debug('histedit: processing %s %s\n' % (action, ha))
644 actfunc = actiontable[action]
650 actfunc = actiontable[action]
645 state.parentctx, replacement_ = actfunc(ui, repo, state.parentctx,
651 state.parentctx, replacement_ = actfunc(ui, state, ha, opts)
646 ha, opts)
647 state.replacements.extend(replacement_)
652 state.replacements.extend(replacement_)
648
653
649 hg.update(repo, state.parentctx.node())
654 hg.update(repo, state.parentctx.node())
General Comments 0
You need to be logged in to leave comments. Login now