--- a/mercurial/commit.py Tue Mar 02 00:05:22 2021 +0100
+++ b/mercurial/commit.py Thu Mar 18 18:24:59 2021 -0400
@@ -359,19 +359,15 @@
elif fparent1 == nullid:
fparent1, fparent2 = fparent2, nullid
elif fparent2 != nullid:
- # is one parent an ancestor of the other?
- fparentancestors = flog.commonancestorsheads(fparent1, fparent2)
- if fparent1 in fparentancestors:
+ if ms.active() and ms.extras(fname).get(b'filenode-source') == b'other':
fparent1, fparent2 = fparent2, nullid
- elif fparent2 in fparentancestors:
- fparent2 = nullid
- elif not fparentancestors:
- # TODO: this whole if-else might be simplified much more
- if (
- ms.active()
- and ms.extras(fname).get(b'filenode-source') == b'other'
- ):
+ # is one parent an ancestor of the other?
+ else:
+ fparentancestors = flog.commonancestorsheads(fparent1, fparent2)
+ if fparent1 in fparentancestors:
fparent1, fparent2 = fparent2, nullid
+ elif fparent2 in fparentancestors:
+ fparent2 = nullid
force_new_node = False
# The file might have been deleted by merge code and user explicitly choose