Mercurial > public > mercurial-scm > hg
diff mercurial/merge.py @ 45619:e8078af6af30
merge: if CHANGED_DELETED and KEEP_NEW are actions, choose CHANGED_DELETED
ACTION_KEEP_NEW and ACTION_CHANGED_DELETED are conflicting actions as one says
that file is new while other says that file was present earlier and has
changed-delete conflicts.
Let's do changed-delete which will lead to conflicts and make user choose the
right way.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 30 Sep 2020 18:07:21 +0530 |
parents | ad984583969a |
children | 588068d5f2da |
line wrap: on
line diff
--- a/mercurial/merge.py Wed Sep 30 17:51:40 2020 +0530 +++ b/mercurial/merge.py Wed Sep 30 18:07:21 2020 +0530 @@ -1215,6 +1215,21 @@ repo.ui.note(_(b" %s: picking 'keep absent' action\n") % f) mresult.addfile(f, *bids[mergestatemod.ACTION_KEEP_ABSENT][0]) continue + # ACTION_KEEP_NEW and ACTION_CHANGED_DELETED are conflicting actions + # as one say that file is new while other says that file was present + # earlier too and has a change delete conflict + # Let's fall back to conflicting ACTION_CHANGED_DELETED and let user + # do the right thing + if ( + mergestatemod.ACTION_CHANGED_DELETED in bids + and mergestatemod.ACTION_KEEP_NEW in bids + and len(bids) == 2 + ): + repo.ui.note(_(b" %s: picking 'changed/deleted' action\n") % f) + mresult.addfile( + f, *bids[mergestatemod.ACTION_CHANGED_DELETED][0] + ) + continue # If keep new is an option, let's just do that if mergestatemod.ACTION_KEEP_NEW in bids: repo.ui.note(_(b" %s: picking 'keep new' action\n") % f)