Show More
@@ -428,7 +428,7 b" actiontable = {'p': pick," | |||
|
428 | 428 | _('force outgoing even for unrelated repositories')), |
|
429 | 429 | ('r', 'rev', [], _('first revision to be edited'))], |
|
430 | 430 | _("[PARENT]")) |
|
431 |
def histedit(ui, repo, * |
|
|
431 | def histedit(ui, repo, *freeargs, **opts): | |
|
432 | 432 | """interactively edit changeset history |
|
433 | 433 | """ |
|
434 | 434 | # TODO only abort if we try and histedit mq patches, not just |
@@ -437,13 +437,43 b' def histedit(ui, repo, *parent, **opts):' | |||
|
437 | 437 | if mq and mq.applied: |
|
438 | 438 | raise util.Abort(_('source has mq patches applied')) |
|
439 | 439 | |
|
440 | parent = list(parent) + opts.get('rev', []) | |
|
440 | # basic argument incompatibility processing | |
|
441 | outg = opts.get('outgoing') | |
|
442 | cont = opts.get('continue') | |
|
443 | abort = opts.get('abort') | |
|
444 | force = opts.get('force') | |
|
445 | rules = opts.get('commands', '') | |
|
446 | revs = opts.get('rev', []) | |
|
447 | goal = 'new' # This invocation goal, in new, continue, abort | |
|
448 | if force and not outg: | |
|
449 | raise util.Abort(_('--force only allowed with --outgoing')) | |
|
450 | if cont: | |
|
451 | if util.any((outg, abort, revs, freeargs, rules)): | |
|
452 | raise util.Abort(_('no arguments allowed with --continue')) | |
|
453 | goal = 'continue' | |
|
454 | elif abort: | |
|
455 | if util.any((outg, revs, freeargs, rules)): | |
|
456 | raise util.Abort(_('no arguments allowed with --abort')) | |
|
457 | goal = 'abort' | |
|
458 | else: | |
|
459 | if os.path.exists(os.path.join(repo.path, 'histedit-state')): | |
|
460 | raise util.Abort(_('history edit already in progress, try ' | |
|
461 | '--continue or --abort')) | |
|
462 | if outg: | |
|
463 | if revs: | |
|
464 | raise util.Abort(_('no revisions allowed with --outgoing')) | |
|
465 | if len(freeargs) > 1: | |
|
466 | raise util.Abort( | |
|
467 | _('only one repo argument allowed with --outgoing')) | |
|
468 | else: | |
|
469 | parent = list(freeargs) + opts.get('rev', []) | |
|
470 | if len(parent) != 1: | |
|
471 | raise util.Abort( | |
|
472 | _('histedit requires exactly one parent revision')) | |
|
473 | ||
|
441 | 474 | if opts.get('outgoing'): |
|
442 |
if |
|
|
443 | raise util.Abort( | |
|
444 | _('only one repo argument allowed with --outgoing')) | |
|
445 | elif parent: | |
|
446 | parent = parent[0] | |
|
475 | if freeargs: | |
|
476 | parent = freeargs[0] | |
|
447 | 477 | |
|
448 | 478 | dest = ui.expandpath(parent or 'default-push', parent or 'default') |
|
449 | 479 | dest, revs = hg.parseurl(dest, None)[:2] |
@@ -460,22 +490,17 b' def histedit(ui, repo, *parent, **opts):' | |||
|
460 | 490 | # contains special revset characters like ":" the revset |
|
461 | 491 | # parser can choke. |
|
462 | 492 | parent = [node.hex(n) for n in discovery.findcommonoutgoing( |
|
463 |
repo, other, revs, force= |
|
|
464 | else: | |
|
465 | if opts.get('force'): | |
|
466 | raise util.Abort(_('--force only allowed with --outgoing')) | |
|
493 | repo, other, revs, force=force).missing[0:1]] | |
|
494 | if not parent: | |
|
495 | raise util.Abort(_('no outgoing ancestors')) | |
|
467 | 496 | |
|
468 |
if |
|
|
469 | if len(parent) != 0: | |
|
470 | raise util.Abort(_('no arguments allowed with --continue')) | |
|
497 | if goal == 'continue': | |
|
471 | 498 | (parentctxnode, rules, keep, topmost, replacements) = readstate(repo) |
|
472 | 499 | currentparent, wantnull = repo.dirstate.parents() |
|
473 | 500 | parentctx = repo[parentctxnode] |
|
474 | 501 | parentctx, repl = bootstrapcontinue(ui, repo, parentctx, rules, opts) |
|
475 | 502 | replacements.extend(repl) |
|
476 |
elif |
|
|
477 | if len(parent) != 0: | |
|
478 | raise util.Abort(_('no arguments allowed with --abort')) | |
|
503 | elif goal == 'abort': | |
|
479 | 504 | (parentctxnode, rules, keep, topmost, replacements) = readstate(repo) |
|
480 | 505 | mapping, tmpnodes, leafs, _ntm = processreplacement(repo, replacements) |
|
481 | 506 | ui.debug('restore wc to old parent %s\n' % node.short(topmost)) |
@@ -486,14 +511,9 b' def histedit(ui, repo, *parent, **opts):' | |||
|
486 | 511 | return |
|
487 | 512 | else: |
|
488 | 513 | cmdutil.bailifchanged(repo) |
|
489 | if os.path.exists(os.path.join(repo.path, 'histedit-state')): | |
|
490 | raise util.Abort(_('history edit already in progress, try ' | |
|
491 | '--continue or --abort')) | |
|
492 | 514 | |
|
493 | 515 | topmost, empty = repo.dirstate.parents() |
|
494 | 516 | |
|
495 | if len(parent) != 1: | |
|
496 | raise util.Abort(_('histedit requires exactly one parent revision')) | |
|
497 | 517 | parent = scmutil.revsingle(repo, parent[0]).node() |
|
498 | 518 | |
|
499 | 519 | keep = opts.get('keep', False) |
@@ -503,7 +523,6 b' def histedit(ui, repo, *parent, **opts):' | |||
|
503 | 523 | node.short(parent)) |
|
504 | 524 | |
|
505 | 525 | ctxs = [repo[r] for r in revs] |
|
506 | rules = opts.get('commands', '') | |
|
507 | 526 | if not rules: |
|
508 | 527 | rules = '\n'.join([makedesc(c) for c in ctxs]) |
|
509 | 528 | rules += '\n\n' |
@@ -240,7 +240,7 b' edit the history, this time with a fold ' | |||
|
240 | 240 | |
|
241 | 241 | $ echo 'I can haz no commute' > e |
|
242 | 242 | $ hg resolve --mark e |
|
243 |
$ hg histedit |
|
|
243 | $ hg histedit --continue 2>&1 | fixbundle | |
|
244 | 244 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
245 | 245 | merging e |
|
246 | 246 | warning: conflicts during merge. |
General Comments 0
You need to be logged in to leave comments.
Login now