324 date=date, |
324 date=date, |
325 extra=extra, |
325 extra=extra, |
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) |
333 return oldctx, [] |
334 return oldctx, [] |
334 hg.update(repo, ctx.node()) |
335 hg.update(repo, ctx.node()) |
346 return ctx, [] |
347 return ctx, [] |
347 new = repo[n] |
348 new = repo[n] |
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) |
355 raise error.InterventionRequired( |
357 raise error.InterventionRequired( |
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) |
368 if stats and stats[3] > 0: |
372 if stats and stats[3] > 0: |
369 raise error.InterventionRequired( |
373 raise error.InterventionRequired( |
415 ] |
419 ] |
416 for ich in internalchanges: |
420 for ich in internalchanges: |
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) |
428 if stats and stats[3] > 0: |
434 if stats and stats[3] > 0: |
429 raise error.InterventionRequired( |
435 raise error.InterventionRequired( |
640 while state.rules: |
646 while state.rules: |
641 state.write() |
647 state.write() |
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()) |
650 |
655 |
651 mapping, tmpnodes, created, ntm = processreplacement(repo, state) |
656 mapping, tmpnodes, created, ntm = processreplacement(repo, state) |