Show More
@@ -2194,7 +2194,8 b' def update(repo, node, branchmerge, forc' | |||
|
2194 | 2194 | error=stats.unresolvedcount) |
|
2195 | 2195 | return stats |
|
2196 | 2196 | |
|
2197 |
def graft(repo, ctx, pctx, labels, keepparent=False |
|
|
2197 | def graft(repo, ctx, pctx, labels, keepparent=False, | |
|
2198 | keepconflictparent=False): | |
|
2198 | 2199 | """Do a graft-like merge. |
|
2199 | 2200 | |
|
2200 | 2201 | This is a merge where the merge ancestor is chosen such that one |
@@ -2207,6 +2208,7 b' def graft(repo, ctx, pctx, labels, keepp' | |||
|
2207 | 2208 | pctx - merge base, usually ctx.p1() |
|
2208 | 2209 | labels - merge labels eg ['local', 'graft'] |
|
2209 | 2210 | keepparent - keep second parent if any |
|
2211 | keepparent - if unresolved, keep parent used for the merge | |
|
2210 | 2212 | |
|
2211 | 2213 | """ |
|
2212 | 2214 | # If we're grafting a descendant onto an ancestor, be sure to pass |
@@ -2220,11 +2222,15 b' def graft(repo, ctx, pctx, labels, keepp' | |||
|
2220 | 2222 | stats = update(repo, ctx.node(), True, True, pctx.node(), |
|
2221 | 2223 | mergeancestor=mergeancestor, labels=labels) |
|
2222 | 2224 | |
|
2223 | pother = nullid | |
|
2224 | parents = ctx.parents() | |
|
2225 | if keepparent and len(parents) == 2 and pctx in parents: | |
|
2226 | parents.remove(pctx) | |
|
2227 |
pother = |
|
|
2225 | ||
|
2226 | if keepconflictparent and stats.unresolvedcount: | |
|
2227 | pother = ctx.node() | |
|
2228 | else: | |
|
2229 | pother = nullid | |
|
2230 | parents = ctx.parents() | |
|
2231 | if keepparent and len(parents) == 2 and pctx in parents: | |
|
2232 | parents.remove(pctx) | |
|
2233 | pother = parents[0].node() | |
|
2228 | 2234 | |
|
2229 | 2235 | with repo.dirstate.parentchange(): |
|
2230 | 2236 | repo.setparents(repo['.'].node(), pother) |
General Comments 0
You need to be logged in to leave comments.
Login now