Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
45618:29c1d2401823 | 45619:e8078af6af30 |
---|---|
1212 continue | 1212 continue |
1213 # If keep absent is an option, just do that | 1213 # If keep absent is an option, just do that |
1214 if mergestatemod.ACTION_KEEP_ABSENT in bids: | 1214 if mergestatemod.ACTION_KEEP_ABSENT in bids: |
1215 repo.ui.note(_(b" %s: picking 'keep absent' action\n") % f) | 1215 repo.ui.note(_(b" %s: picking 'keep absent' action\n") % f) |
1216 mresult.addfile(f, *bids[mergestatemod.ACTION_KEEP_ABSENT][0]) | 1216 mresult.addfile(f, *bids[mergestatemod.ACTION_KEEP_ABSENT][0]) |
1217 continue | |
1218 # ACTION_KEEP_NEW and ACTION_CHANGED_DELETED are conflicting actions | |
1219 # as one say that file is new while other says that file was present | |
1220 # earlier too and has a change delete conflict | |
1221 # Let's fall back to conflicting ACTION_CHANGED_DELETED and let user | |
1222 # do the right thing | |
1223 if ( | |
1224 mergestatemod.ACTION_CHANGED_DELETED in bids | |
1225 and mergestatemod.ACTION_KEEP_NEW in bids | |
1226 and len(bids) == 2 | |
1227 ): | |
1228 repo.ui.note(_(b" %s: picking 'changed/deleted' action\n") % f) | |
1229 mresult.addfile( | |
1230 f, *bids[mergestatemod.ACTION_CHANGED_DELETED][0] | |
1231 ) | |
1217 continue | 1232 continue |
1218 # If keep new is an option, let's just do that | 1233 # If keep new is an option, let's just do that |
1219 if mergestatemod.ACTION_KEEP_NEW in bids: | 1234 if mergestatemod.ACTION_KEEP_NEW in bids: |
1220 repo.ui.note(_(b" %s: picking 'keep new' action\n") % f) | 1235 repo.ui.note(_(b" %s: picking 'keep new' action\n") % f) |
1221 mresult.addfile(f, *bids[mergestatemod.ACTION_KEEP_NEW][0]) | 1236 mresult.addfile(f, *bids[mergestatemod.ACTION_KEEP_NEW][0]) |