I also updated the callers that wanted that, partly to simplify and
partly to show that it works.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
I also updated the callers that wanted that, partly to simplify and
partly to show that it works.
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | hgext/histedit.py (2 lines) | |||
M | mercurial/merge.py (5 lines) | |||
M | mercurial/shelve.py (1 line) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
0176f85eb965 | 1e03ea31e83a | Martin von Zweigbergk | Jan 28 2020, 5:53 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz |
stats = mergemod.updateresult(0, 0, 0, 0) | stats = mergemod.updateresult(0, 0, 0, 0) | ||||
ui.popbuffer() | ui.popbuffer() | ||||
else: | else: | ||||
try: | try: | ||||
# ui.forcemerge is an internal variable, do not document | # ui.forcemerge is an internal variable, do not document | ||||
repo.ui.setconfig( | repo.ui.setconfig( | ||||
b'ui', b'forcemerge', opts.get(b'tool', b''), b'histedit' | b'ui', b'forcemerge', opts.get(b'tool', b''), b'histedit' | ||||
) | ) | ||||
stats = mergemod.graft(repo, ctx, ctx.p1(), [b'local', b'histedit']) | stats = mergemod.graft(repo, ctx, labels=[b'local', b'histedit']) | ||||
finally: | finally: | ||||
repo.ui.setconfig(b'ui', b'forcemerge', b'', b'histedit') | repo.ui.setconfig(b'ui', b'forcemerge', b'', b'histedit') | ||||
return stats | return stats | ||||
def collapse(repo, firstctx, lastctx, commitopts, skipprompt=False): | def collapse(repo, firstctx, lastctx, commitopts, skipprompt=False): | ||||
"""collapse the set of revisions from first to last as new one. | """collapse the set of revisions from first to last as new one. | ||||
b'update', parent1=xp1, parent2=xp2, error=stats.unresolvedcount | b'update', parent1=xp1, parent2=xp2, error=stats.unresolvedcount | ||||
) | ) | ||||
return stats | return stats | ||||
def graft( | def graft( | ||||
repo, | repo, | ||||
ctx, | ctx, | ||||
base, | base=None, | ||||
labels=None, | labels=None, | ||||
keepparent=False, | keepparent=False, | ||||
keepconflictparent=False, | keepconflictparent=False, | ||||
wctx=None, | wctx=None, | ||||
): | ): | ||||
"""Do a graft-like merge. | """Do a graft-like merge. | ||||
This is a merge where the merge ancestor is chosen such that one | This is a merge where the merge ancestor is chosen such that one | ||||
or more changesets are grafted onto the current changeset. In | or more changesets are grafted onto the current changeset. In | ||||
addition to the merge, this fixes up the dirstate to include only | addition to the merge, this fixes up the dirstate to include only | ||||
a single parent (if keepparent is False) and tries to duplicate any | a single parent (if keepparent is False) and tries to duplicate any | ||||
renames/copies appropriately. | renames/copies appropriately. | ||||
ctx - changeset to rebase | ctx - changeset to rebase | ||||
base - merge base, usually ctx.p1() | base - merge base, or ctx.p1() if not specified | ||||
labels - merge labels eg ['local', 'graft'] | labels - merge labels eg ['local', 'graft'] | ||||
keepparent - keep second parent if any | keepparent - keep second parent if any | ||||
keepconflictparent - if unresolved, keep parent used for the merge | keepconflictparent - if unresolved, keep parent used for the merge | ||||
""" | """ | ||||
# If we're grafting a descendant onto an ancestor, be sure to pass | # If we're grafting a descendant onto an ancestor, be sure to pass | ||||
# mergeancestor=True to update. This does two things: 1) allows the merge if | # mergeancestor=True to update. This does two things: 1) allows the merge if | ||||
# the destination is the same as the parent of the ctx (so we can use graft | # the destination is the same as the parent of the ctx (so we can use graft | ||||
# to copy commits), and 2) informs update that the incoming changes are | # to copy commits), and 2) informs update that the incoming changes are | ||||
# newer than the destination so it doesn't prompt about "remote changed foo | # newer than the destination so it doesn't prompt about "remote changed foo | ||||
# which local deleted". | # which local deleted". | ||||
wctx = wctx or repo[None] | wctx = wctx or repo[None] | ||||
pctx = wctx.p1() | pctx = wctx.p1() | ||||
base = base or ctx.p1() | |||||
mergeancestor = repo.changelog.isancestor(pctx.node(), ctx.node()) | mergeancestor = repo.changelog.isancestor(pctx.node(), ctx.node()) | ||||
stats = update( | stats = update( | ||||
repo, | repo, | ||||
ctx.node(), | ctx.node(), | ||||
True, | True, | ||||
True, | True, | ||||
base.node(), | base.node(), |
(b'ui', b'forcemerge'): opts.get(b'tool', b''), | (b'ui', b'forcemerge'): opts.get(b'tool', b''), | ||||
(b'phases', b'new-commit'): phases.secret, | (b'phases', b'new-commit'): phases.secret, | ||||
} | } | ||||
with repo.ui.configoverride(overrides, b'unshelve'): | with repo.ui.configoverride(overrides, b'unshelve'): | ||||
ui.status(_(b'rebasing shelved changes\n')) | ui.status(_(b'rebasing shelved changes\n')) | ||||
stats = merge.graft( | stats = merge.graft( | ||||
repo, | repo, | ||||
shelvectx, | shelvectx, | ||||
shelvectx.p1(), | |||||
labels=[b'shelve', b'working-copy'], | labels=[b'shelve', b'working-copy'], | ||||
keepconflictparent=True, | keepconflictparent=True, | ||||
) | ) | ||||
if stats.unresolvedcount: | if stats.unresolvedcount: | ||||
tr.close() | tr.close() | ||||
nodestoremove = [ | nodestoremove = [ | ||||
repo.changelog.node(rev) | repo.changelog.node(rev) |