Show More
@@ -419,62 +419,11 b' def histedit(ui, repo, *parent, **opts):' | |||||
419 | raise util.Abort(_('no arguments allowed with --continue')) |
|
419 | raise util.Abort(_('no arguments allowed with --continue')) | |
420 | (parentctxnode, created, replaced, tmpnodes, |
|
420 | (parentctxnode, created, replaced, tmpnodes, | |
421 | existing, rules, keep, topmost, replacemap) = readstate(repo) |
|
421 | existing, rules, keep, topmost, replacemap) = readstate(repo) | |
422 | currentparent, wantnull = repo.dirstate.parents() |
|
|||
423 | parentctx = repo[parentctxnode] |
|
422 | parentctx = repo[parentctxnode] | |
424 | # existing is the list of revisions initially considered by |
|
|||
425 | # histedit. Here we use it to list new changesets, descendants |
|
|||
426 | # of parentctx without an 'existing' changeset in-between. We |
|
|||
427 | # also have to exclude 'existing' changesets which were |
|
|||
428 | # previously dropped. |
|
|||
429 | descendants = set(c.node() for c in |
|
|||
430 | repo.set('(%n::) - %n', parentctxnode, parentctxnode)) |
|
|||
431 | existing = set(existing) |
|
423 | existing = set(existing) | |
432 | notdropped = set(n for n in existing if n in descendants and |
|
424 | parentctx = bootstrapcontinue(ui, repo, parentctx, existing, | |
433 | (n not in replacemap or replacemap[n] in descendants)) |
|
425 | replacemap, rules, tmpnodes, created, | |
434 | # Discover any nodes the user has added in the interim. We can |
|
426 | replaced, opts) | |
435 | # miss changesets which were dropped and recreated the same. |
|
|||
436 | newchildren = list(c.node() for c in repo.set( |
|
|||
437 | 'sort(%ln - (%ln or %ln::))', descendants, existing, notdropped)) |
|
|||
438 | action, currentnode = rules.pop(0) |
|
|||
439 | if action in ('f', 'fold'): |
|
|||
440 | tmpnodes.extend(newchildren) |
|
|||
441 | else: |
|
|||
442 | created.extend(newchildren) |
|
|||
443 |
|
||||
444 | m, a, r, d = repo.status()[:4] |
|
|||
445 | oldctx = repo[currentnode] |
|
|||
446 | message = oldctx.description() + '\n' |
|
|||
447 | if action in ('e', 'edit', 'm', 'mess'): |
|
|||
448 | message = ui.edit(message, ui.username()) |
|
|||
449 | elif action in ('f', 'fold'): |
|
|||
450 | message = 'fold-temp-revision %s' % currentnode |
|
|||
451 | new = None |
|
|||
452 | if m or a or r or d: |
|
|||
453 | new = repo.commit(text=message, user=oldctx.user(), |
|
|||
454 | date=oldctx.date(), extra=oldctx.extra()) |
|
|||
455 |
|
||||
456 | # If we're resuming a fold and we have new changes, mark the |
|
|||
457 | # replacements and finish the fold. If not, it's more like a |
|
|||
458 | # drop of the changesets that disappeared, and we can skip |
|
|||
459 | # this step. |
|
|||
460 | if action in ('f', 'fold') and (new or newchildren): |
|
|||
461 | if new: |
|
|||
462 | tmpnodes.append(new) |
|
|||
463 | else: |
|
|||
464 | new = newchildren[-1] |
|
|||
465 | (parentctx, created_, replaced_, tmpnodes_) = finishfold( |
|
|||
466 | ui, repo, parentctx, oldctx, new, opts, newchildren) |
|
|||
467 | replaced.extend(replaced_) |
|
|||
468 | created.extend(created_) |
|
|||
469 | tmpnodes.extend(tmpnodes_) |
|
|||
470 | elif action not in ('d', 'drop'): |
|
|||
471 | if new != oldctx.node(): |
|
|||
472 | replaced.append(oldctx.node()) |
|
|||
473 | if new: |
|
|||
474 | if new != oldctx.node(): |
|
|||
475 | created.append(new) |
|
|||
476 | parentctx = repo[new] |
|
|||
477 |
|
||||
478 | elif opts.get('abort', False): |
|
427 | elif opts.get('abort', False): | |
479 | if len(parent) != 0: |
|
428 | if len(parent) != 0: | |
480 | raise util.Abort(_('no arguments allowed with --abort')) |
|
429 | raise util.Abort(_('no arguments allowed with --abort')) | |
@@ -599,6 +548,64 b' def histedit(ui, repo, *parent, **opts):' | |||||
599 | os.unlink(repo.sjoin('undo')) |
|
548 | os.unlink(repo.sjoin('undo')) | |
600 |
|
549 | |||
601 |
|
550 | |||
|
551 | def bootstrapcontinue(ui, repo, parentctx, existing, replacemap, rules, | |||
|
552 | tmpnodes, created, replaced, opts): | |||
|
553 | currentparent, wantnull = repo.dirstate.parents() | |||
|
554 | # existing is the list of revisions initially considered by | |||
|
555 | # histedit. Here we use it to list new changesets, descendants | |||
|
556 | # of parentctx without an 'existing' changeset in-between. We | |||
|
557 | # also have to exclude 'existing' changesets which were | |||
|
558 | # previously dropped. | |||
|
559 | descendants = set(c.node() for c in | |||
|
560 | repo.set('(%d::) - %d', parentctx, parentctx)) | |||
|
561 | notdropped = set(n for n in existing if n in descendants and | |||
|
562 | (n not in replacemap or replacemap[n] in descendants)) | |||
|
563 | # Discover any nodes the user has added in the interim. We can | |||
|
564 | # miss changesets which were dropped and recreated the same. | |||
|
565 | newchildren = list(c.node() for c in repo.set( | |||
|
566 | 'sort(%ln - (%ln or %ln::))', descendants, existing, notdropped)) | |||
|
567 | action, currentnode = rules.pop(0) | |||
|
568 | if action in ('f', 'fold'): | |||
|
569 | tmpnodes.extend(newchildren) | |||
|
570 | else: | |||
|
571 | created.extend(newchildren) | |||
|
572 | ||||
|
573 | m, a, r, d = repo.status()[:4] | |||
|
574 | oldctx = repo[currentnode] | |||
|
575 | message = oldctx.description() + '\n' | |||
|
576 | if action in ('e', 'edit', 'm', 'mess'): | |||
|
577 | message = ui.edit(message, ui.username()) | |||
|
578 | elif action in ('f', 'fold'): | |||
|
579 | message = 'fold-temp-revision %s' % currentnode | |||
|
580 | new = None | |||
|
581 | if m or a or r or d: | |||
|
582 | new = repo.commit(text=message, user=oldctx.user(), | |||
|
583 | date=oldctx.date(), extra=oldctx.extra()) | |||
|
584 | ||||
|
585 | # If we're resuming a fold and we have new changes, mark the | |||
|
586 | # replacements and finish the fold. If not, it's more like a | |||
|
587 | # drop of the changesets that disappeared, and we can skip | |||
|
588 | # this step. | |||
|
589 | if action in ('f', 'fold') and (new or newchildren): | |||
|
590 | if new: | |||
|
591 | tmpnodes.append(new) | |||
|
592 | else: | |||
|
593 | new = newchildren[-1] | |||
|
594 | (parentctx, created_, replaced_, tmpnodes_) = finishfold( | |||
|
595 | ui, repo, parentctx, oldctx, new, opts, newchildren) | |||
|
596 | replaced.extend(replaced_) | |||
|
597 | created.extend(created_) | |||
|
598 | tmpnodes.extend(tmpnodes_) | |||
|
599 | elif action not in ('d', 'drop'): | |||
|
600 | if new != oldctx.node(): | |||
|
601 | replaced.append(oldctx.node()) | |||
|
602 | if new: | |||
|
603 | if new != oldctx.node(): | |||
|
604 | created.append(new) | |||
|
605 | parentctx = repo[new] | |||
|
606 | return parentctx | |||
|
607 | ||||
|
608 | ||||
602 | def between(repo, old, new, keep): |
|
609 | def between(repo, old, new, keep): | |
603 | """select and validate the set of revision to edit |
|
610 | """select and validate the set of revision to edit | |
604 |
|
611 |
General Comments 0
You need to be logged in to leave comments.
Login now