1378 fbids[f] = {m: [a]} |
1378 fbids[f] = {m: [a]} |
1379 |
1379 |
1380 # Pick the best bid for each file |
1380 # Pick the best bid for each file |
1381 repo.ui.note(_('\nauction for merging merge bids\n')) |
1381 repo.ui.note(_('\nauction for merging merge bids\n')) |
1382 actions = {} |
1382 actions = {} |
1383 dms = [] # filenames that have dm actions |
|
1384 for f, bids in sorted(fbids.items()): |
1383 for f, bids in sorted(fbids.items()): |
1385 # bids is a mapping from action method to list af actions |
1384 # bids is a mapping from action method to list af actions |
1386 # Consensus? |
1385 # Consensus? |
1387 if len(bids) == 1: # all bids are the same kind of method |
1386 if len(bids) == 1: # all bids are the same kind of method |
1388 m, l = list(bids.items())[0] |
1387 m, l = list(bids.items())[0] |
1389 if all(a == l[0] for a in l[1:]): # len(bids) is > 1 |
1388 if all(a == l[0] for a in l[1:]): # len(bids) is > 1 |
1390 repo.ui.note(_(" %s: consensus for %s\n") % (f, m)) |
1389 repo.ui.note(_(" %s: consensus for %s\n") % (f, m)) |
1391 actions[f] = l[0] |
1390 actions[f] = l[0] |
1392 if m == ACTION_DIR_RENAME_MOVE_LOCAL: |
|
1393 dms.append(f) |
|
1394 continue |
1391 continue |
1395 # If keep is an option, just do it. |
1392 # If keep is an option, just do it. |
1396 if ACTION_KEEP in bids: |
1393 if ACTION_KEEP in bids: |
1397 repo.ui.note(_(" %s: picking 'keep' action\n") % f) |
1394 repo.ui.note(_(" %s: picking 'keep' action\n") % f) |
1398 actions[f] = bids[ACTION_KEEP][0] |
1395 actions[f] = bids[ACTION_KEEP][0] |
1413 # Pick random action. TODO: Instead, prompt user when resolving |
1410 # Pick random action. TODO: Instead, prompt user when resolving |
1414 m, l = list(bids.items())[0] |
1411 m, l = list(bids.items())[0] |
1415 repo.ui.warn(_(' %s: ambiguous merge - picked %s action\n') % |
1412 repo.ui.warn(_(' %s: ambiguous merge - picked %s action\n') % |
1416 (f, m)) |
1413 (f, m)) |
1417 actions[f] = l[0] |
1414 actions[f] = l[0] |
1418 if m == ACTION_DIR_RENAME_MOVE_LOCAL: |
|
1419 dms.append(f) |
|
1420 continue |
1415 continue |
1421 # Work around 'dm' that can cause multiple actions for the same file |
|
1422 for f in dms: |
|
1423 dm, (f0, flags), msg = actions[f] |
|
1424 assert dm == ACTION_DIR_RENAME_MOVE_LOCAL, dm |
|
1425 if f0 in actions and actions[f0][0] == ACTION_REMOVE: |
|
1426 # We have one bid for removing a file and another for moving it. |
|
1427 # These two could be merged as first move and then delete ... |
|
1428 # but instead drop moving and just delete. |
|
1429 del actions[f] |
|
1430 repo.ui.note(_('end of auction\n\n')) |
1416 repo.ui.note(_('end of auction\n\n')) |
1431 |
1417 |
1432 if wctx.rev() is None: |
1418 if wctx.rev() is None: |
1433 fractions = _forgetremoved(wctx, mctx, branchmerge) |
1419 fractions = _forgetremoved(wctx, mctx, branchmerge) |
1434 actions.update(fractions) |
1420 actions.update(fractions) |