diff --git a/mercurial/merge.py b/mercurial/merge.py
index e26c2440a030b2c5fc43de1a2feedee37d437557_bWVyY3VyaWFsL21lcmdlLnB5..085295f828459f8ce90f6f5889bac3e0405945a8_bWVyY3VyaWFsL21lcmdlLnB5 100644
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -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()