comparison mercurial/merge.py @ 45617: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
comparison
equal deleted inserted replaced
45616:64461b43a7bf 45617:ad984583969a
1217 continue 1217 continue
1218 # If keep new is an option, let's just do that 1218 # If keep new is an option, let's just do that
1219 if mergestatemod.ACTION_KEEP_NEW in bids: 1219 if mergestatemod.ACTION_KEEP_NEW in bids:
1220 repo.ui.note(_(b" %s: picking 'keep new' action\n") % f) 1220 repo.ui.note(_(b" %s: picking 'keep new' action\n") % f)
1221 mresult.addfile(f, *bids[mergestatemod.ACTION_KEEP_NEW][0]) 1221 mresult.addfile(f, *bids[mergestatemod.ACTION_KEEP_NEW][0])
1222 continue
1223 # ACTION_GET and ACTION_DELETE_CHANGED are conflicting actions as
1224 # one action states the file is newer/created on remote side and
1225 # other states that file is deleted locally and changed on remote
1226 # side. Let's fallback and rely on a conflicting action to let user
1227 # do the right thing
1228 if (
1229 mergestatemod.ACTION_DELETED_CHANGED in bids
1230 and mergestatemod.ACTION_GET in bids
1231 and len(bids) == 2
1232 ):
1233 repo.ui.note(_(b" %s: picking 'delete/changed' action\n") % f)
1234 mresult.addfile(
1235 f, *bids[mergestatemod.ACTION_DELETED_CHANGED][0]
1236 )
1222 continue 1237 continue
1223 # If there are gets and they all agree [how could they not?], do it. 1238 # If there are gets and they all agree [how could they not?], do it.
1224 if mergestatemod.ACTION_GET in bids: 1239 if mergestatemod.ACTION_GET in bids:
1225 ga0 = bids[mergestatemod.ACTION_GET][0] 1240 ga0 = bids[mergestatemod.ACTION_GET][0]
1226 if all(a == ga0 for a in bids[mergestatemod.ACTION_GET][1:]): 1241 if all(a == ga0 for a in bids[mergestatemod.ACTION_GET][1:]):