Mercurial > hg
comparison mercurial/merge.py @ 44212:cb8b67016110
graft: default `base` argument to common case of `ctx.p1()`
I also updated the callers that wanted that, partly to simplify and
partly to show that it works.
Differential Revision: https://phab.mercurial-scm.org/D8027
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 28 Jan 2020 14:53:23 -0800 |
parents | fc7175df6359 |
children | b1069b369d6e |
comparison
equal
deleted
inserted
replaced
44211:fc7175df6359 | 44212:cb8b67016110 |
---|---|
2590 | 2590 |
2591 | 2591 |
2592 def graft( | 2592 def graft( |
2593 repo, | 2593 repo, |
2594 ctx, | 2594 ctx, |
2595 base, | 2595 base=None, |
2596 labels=None, | 2596 labels=None, |
2597 keepparent=False, | 2597 keepparent=False, |
2598 keepconflictparent=False, | 2598 keepconflictparent=False, |
2599 wctx=None, | 2599 wctx=None, |
2600 ): | 2600 ): |
2605 addition to the merge, this fixes up the dirstate to include only | 2605 addition to the merge, this fixes up the dirstate to include only |
2606 a single parent (if keepparent is False) and tries to duplicate any | 2606 a single parent (if keepparent is False) and tries to duplicate any |
2607 renames/copies appropriately. | 2607 renames/copies appropriately. |
2608 | 2608 |
2609 ctx - changeset to rebase | 2609 ctx - changeset to rebase |
2610 base - merge base, usually ctx.p1() | 2610 base - merge base, or ctx.p1() if not specified |
2611 labels - merge labels eg ['local', 'graft'] | 2611 labels - merge labels eg ['local', 'graft'] |
2612 keepparent - keep second parent if any | 2612 keepparent - keep second parent if any |
2613 keepconflictparent - if unresolved, keep parent used for the merge | 2613 keepconflictparent - if unresolved, keep parent used for the merge |
2614 | 2614 |
2615 """ | 2615 """ |
2619 # to copy commits), and 2) informs update that the incoming changes are | 2619 # to copy commits), and 2) informs update that the incoming changes are |
2620 # newer than the destination so it doesn't prompt about "remote changed foo | 2620 # newer than the destination so it doesn't prompt about "remote changed foo |
2621 # which local deleted". | 2621 # which local deleted". |
2622 wctx = wctx or repo[None] | 2622 wctx = wctx or repo[None] |
2623 pctx = wctx.p1() | 2623 pctx = wctx.p1() |
2624 base = base or ctx.p1() | |
2624 mergeancestor = repo.changelog.isancestor(pctx.node(), ctx.node()) | 2625 mergeancestor = repo.changelog.isancestor(pctx.node(), ctx.node()) |
2625 | 2626 |
2626 stats = update( | 2627 stats = update( |
2627 repo, | 2628 repo, |
2628 ctx.node(), | 2629 ctx.node(), |