Mercurial > public > mercurial-scm > hg-stable
diff mercurial/merge.py @ 45620:ad984583969a
merge: if DELETED_CHANGED and GET are in actions, choose DELETED_CHANGED
ACTION_GET represents that either the file is created on remote or it's newer on
the remote side. However, since we have a ACTION_DELETE_CHANGED too, it means
the file is not present locally and ACTION_GET is representing that file was
created on remote.
Having both ACTION_GET and ACTION_DELETED_CHANGED is conflicting because one
says that file was created on remote and other says file has delete-changed
conflicts.
Let's choose ACTION_DELETED_CHANGED which will result in conflicts and make user
choose the right way forward.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 30 Sep 2020 15:46:54 +0530 |
parents | 768412472663 |
children | e8078af6af30 |
line wrap: on
line diff
--- a/mercurial/merge.py Wed Sep 30 15:09:25 2020 +0530 +++ b/mercurial/merge.py Wed Sep 30 15:46:54 2020 +0530 @@ -1220,6 +1220,21 @@ repo.ui.note(_(b" %s: picking 'keep new' action\n") % f) mresult.addfile(f, *bids[mergestatemod.ACTION_KEEP_NEW][0]) continue + # ACTION_GET and ACTION_DELETE_CHANGED are conflicting actions as + # one action states the file is newer/created on remote side and + # other states that file is deleted locally and changed on remote + # side. Let's fallback and rely on a conflicting action to let user + # do the right thing + if ( + mergestatemod.ACTION_DELETED_CHANGED in bids + and mergestatemod.ACTION_GET in bids + and len(bids) == 2 + ): + repo.ui.note(_(b" %s: picking 'delete/changed' action\n") % f) + mresult.addfile( + f, *bids[mergestatemod.ACTION_DELETED_CHANGED][0] + ) + continue # If there are gets and they all agree [how could they not?], do it. if mergestatemod.ACTION_GET in bids: ga0 = bids[mergestatemod.ACTION_GET][0]