Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/merge.py @ 42676:a4ca0610c754 stable
merge: respect parents order when using `graft` on a merge
The previous code did not record the index of the replaced parent. It was always
using the "graft" destination as `p1`. This could switch parents order in some
situation (eg: some of the evolve evolving merge case). Recording and using the
information fixes the issue in evolve.
We are not aware of core commands calling graft in that fashion, so we could not
build a simple test case for it using core commands.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 09 Sep 2019 17:32:21 +0200 |
parents | d29db0a0c4eb |
children | 085295f82845 f059d6ffcdf0 |
comparison
equal
deleted
inserted
replaced
42675:344a086bb764 | 42676:a4ca0610c754 |
---|---|
2247 | 2247 |
2248 stats = update(repo, ctx.node(), True, True, pctx.node(), | 2248 stats = update(repo, ctx.node(), True, True, pctx.node(), |
2249 mergeancestor=mergeancestor, labels=labels) | 2249 mergeancestor=mergeancestor, labels=labels) |
2250 | 2250 |
2251 | 2251 |
2252 potherp1 = False | |
2252 if keepconflictparent and stats.unresolvedcount: | 2253 if keepconflictparent and stats.unresolvedcount: |
2253 pother = ctx.node() | 2254 pother = ctx.node() |
2254 else: | 2255 else: |
2255 pother = nullid | 2256 pother = nullid |
2256 parents = ctx.parents() | 2257 parents = ctx.parents() |
2257 if keepparent and len(parents) == 2 and pctx in parents: | 2258 if keepparent and len(parents) == 2 and pctx in parents: |
2259 if pctx == parents[0]: | |
2260 potherp1 = True | |
2258 parents.remove(pctx) | 2261 parents.remove(pctx) |
2259 pother = parents[0].node() | 2262 pother = parents[0].node() |
2260 | 2263 |
2261 with repo.dirstate.parentchange(): | 2264 with repo.dirstate.parentchange(): |
2262 repo.setparents(repo['.'].node(), pother) | 2265 if potherp1: |
2266 repo.setparents(pother, repo['.'].node()) | |
2267 else: | |
2268 repo.setparents(repo['.'].node(), pother) | |
2263 repo.dirstate.write(repo.currenttransaction()) | 2269 repo.dirstate.write(repo.currenttransaction()) |
2264 # fix up dirstate for copies and renames | 2270 # fix up dirstate for copies and renames |
2265 copies.duplicatecopies(repo, repo[None], ctx.rev(), pctx.rev()) | 2271 copies.duplicatecopies(repo, repo[None], ctx.rev(), pctx.rev()) |
2266 return stats | 2272 return stats |
2267 | 2273 |