Patchwork [STABLE] merge: back out changeset a4ca0610c754 (parents order when grafting a merge)

login
register
mail settings
Submitter Anton Shestakov
Date Sept. 23, 2019, 3:56 a.m.
Message ID <6003cc13f906fac5b6d9.1569211014@df1>
Download mbox | patch
Permalink /patch/41734/
State Accepted
Headers show

Comments

Anton Shestakov - Sept. 23, 2019, 3:56 a.m.
# HG changeset patch
# User Anton Shestakov <av6@dwimlabs.net>
# Date 1568997063 -25200
#      Fri Sep 20 23:31:03 2019 +0700
# Branch stable
# Node ID 6003cc13f906fac5b6d93c5eff727e772d3dfc6a
# Parent  085295f828459f8ce90f6f5889bac3e0405945a8
merge: back out changeset a4ca0610c754 (parents order when grafting a merge)

Turns out it's not enough to just swap parents, because when we do, there are
unexpected bad side effects, such as a tracked file becoming untracked. These
side effects need more code to be handled properly, but it's not written yet.
Let's back this feature out from stable for now and some day implement it on
default instead.
Yuya Nishihara - Sept. 23, 2019, 12:30 p.m.
On Mon, 23 Sep 2019 10:56:54 +0700, Anton Shestakov wrote:
> # HG changeset patch
> # User Anton Shestakov <av6@dwimlabs.net>
> # Date 1568997063 -25200
> #      Fri Sep 20 23:31:03 2019 +0700
> # Branch stable
> # Node ID 6003cc13f906fac5b6d93c5eff727e772d3dfc6a
> # Parent  085295f828459f8ce90f6f5889bac3e0405945a8
> merge: back out changeset a4ca0610c754 (parents order when grafting a merge)
> 
> Turns out it's not enough to just swap parents, because when we do, there are
> unexpected bad side effects, such as a tracked file becoming untracked. These
> side effects need more code to be handled properly, but it's not written yet.
> Let's back this feature out from stable for now and some day implement it on
> default instead.

OK. Queued for stable, thanks.

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -2249,23 +2249,17 @@  def graft(repo, ctx, pctx, labels=None, 
                    mergeancestor=mergeancestor, labels=labels)
 
 
-    potherp1 = False
     if keepconflictparent and stats.unresolvedcount:
         pother = ctx.node()
     else:
         pother = nullid
         parents = ctx.parents()
         if keepparent and len(parents) == 2 and pctx in parents:
-            if pctx == parents[1]:
-                potherp1 = True
             parents.remove(pctx)
             pother = parents[0].node()
 
     with repo.dirstate.parentchange():
-        if potherp1:
-            repo.setparents(pother, repo['.'].node())
-        else:
-            repo.setparents(repo['.'].node(), pother)
+        repo.setparents(repo['.'].node(), pother)
         repo.dirstate.write(repo.currenttransaction())
         # fix up dirstate for copies and renames
         copies.duplicatecopies(repo, repo[None], ctx.rev(), pctx.rev())