merge: respect parents order when using `graft` on a merge, this time for real stable
authorAnton Shestakov <av6@dwimlabs.net>
Wed, 18 Sep 2019 17:53:10 +0700
branchstable
changeset 42953 085295f82845
parent 42917 e26c2440a030
child 42954 2c14bf83b58b
child 42958 181e52f2b62f
merge: respect parents order when using `graft` on a merge, this time for real See a4ca0610c754. potherp1 is a boolean variable that means "pother is ctx.p1", and parents is naturally [ctx.p1, ctx.p2]. pctx is always removed from parents, so if pctx is parents[0], then we end up using parents[1] as pother. To be true to its name, potherp1 should then be True only when pctx is at parents[1].
mercurial/merge.py
--- a/mercurial/merge.py	Sat Sep 07 14:35:21 2019 +0100
+++ b/mercurial/merge.py	Wed Sep 18 17:53:10 2019 +0700
@@ -2256,7 +2256,7 @@
         pother = nullid
         parents = ctx.parents()
         if keepparent and len(parents) == 2 and pctx in parents:
-            if pctx == parents[0]:
+            if pctx == parents[1]:
                 potherp1 = True
             parents.remove(pctx)
             pother = parents[0].node()