--- a/mercurial/commit.py Wed Mar 10 15:24:52 2021 +1000
+++ b/mercurial/commit.py Thu Mar 04 17:35:58 2021 +0530
@@ -355,19 +355,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