--- a/mercurial/localrepo.py Thu Apr 09 15:44:21 2020 -0400
+++ b/mercurial/localrepo.py Thu Apr 09 16:06:03 2020 +0530
@@ -2855,6 +2855,14 @@
fparent1, fparent2 = fparent2, nullid
elif fparent2 in fparentancestors:
fparent2 = nullid
+ elif not fparentancestors:
+ # TODO: this whole if-else might be simplified much more
+ ms = mergemod.mergestate.read(self)
+ if (
+ fname in ms
+ and ms[fname] == mergemod.MERGE_RECORD_MERGED_OTHER
+ ):
+ fparent1, fparent2 = fparent2, nullid
# is the file changed?
text = fctx.data()