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