mercurial/commit.py
changeset 46794 e2f7b2695ba1
parent 46371 0903d6b9b1df
parent 46679 d6fa9fbd375d
child 46811 5a0b930cfb3e
equal deleted inserted replaced
46782:6b52cffd8d0a 46794:e2f7b2695ba1
   357             )
   357             )
   358 
   358 
   359     elif fparent1 == nullid:
   359     elif fparent1 == nullid:
   360         fparent1, fparent2 = fparent2, nullid
   360         fparent1, fparent2 = fparent2, nullid
   361     elif fparent2 != nullid:
   361     elif fparent2 != nullid:
       
   362         if ms.active() and ms.extras(fname).get(b'filenode-source') == b'other':
       
   363             fparent1, fparent2 = fparent2, nullid
   362         # is one parent an ancestor of the other?
   364         # is one parent an ancestor of the other?
   363         fparentancestors = flog.commonancestorsheads(fparent1, fparent2)
   365         else:
   364         if fparent1 in fparentancestors:
   366             fparentancestors = flog.commonancestorsheads(fparent1, fparent2)
   365             fparent1, fparent2 = fparent2, nullid
   367             if fparent1 in fparentancestors:
   366         elif fparent2 in fparentancestors:
       
   367             fparent2 = nullid
       
   368         elif not fparentancestors:
       
   369             # TODO: this whole if-else might be simplified much more
       
   370             if (
       
   371                 ms.active()
       
   372                 and ms.extras(fname).get(b'filenode-source') == b'other'
       
   373             ):
       
   374                 fparent1, fparent2 = fparent2, nullid
   368                 fparent1, fparent2 = fparent2, nullid
       
   369             elif fparent2 in fparentancestors:
       
   370                 fparent2 = nullid
   375 
   371 
   376     force_new_node = False
   372     force_new_node = False
   377     # The file might have been deleted by merge code and user explicitly choose
   373     # The file might have been deleted by merge code and user explicitly choose
   378     # to revert the file and keep it. The other case can be where there is
   374     # to revert the file and keep it. The other case can be where there is
   379     # change-delete or delete-change conflict and user explicitly choose to keep
   375     # change-delete or delete-change conflict and user explicitly choose to keep