995 fbids[f] = {m: [a]} |
995 fbids[f] = {m: [a]} |
996 |
996 |
997 # Pick the best bid for each file |
997 # Pick the best bid for each file |
998 repo.ui.note(_('\nauction for merging merge bids\n')) |
998 repo.ui.note(_('\nauction for merging merge bids\n')) |
999 actions = {} |
999 actions = {} |
|
1000 dms = [] # filenames that have dm actions |
1000 for f, bids in sorted(fbids.items()): |
1001 for f, bids in sorted(fbids.items()): |
1001 # bids is a mapping from action method to list af actions |
1002 # bids is a mapping from action method to list af actions |
1002 # Consensus? |
1003 # Consensus? |
1003 if len(bids) == 1: # all bids are the same kind of method |
1004 if len(bids) == 1: # all bids are the same kind of method |
1004 m, l = bids.items()[0] |
1005 m, l = bids.items()[0] |
1005 if all(a == l[0] for a in l[1:]): # len(bids) is > 1 |
1006 if all(a == l[0] for a in l[1:]): # len(bids) is > 1 |
1006 repo.ui.note(_(" %s: consensus for %s\n") % (f, m)) |
1007 repo.ui.note(_(" %s: consensus for %s\n") % (f, m)) |
1007 actions[f] = l[0] |
1008 actions[f] = l[0] |
|
1009 if m == 'dm': |
|
1010 dms.append(f) |
1008 continue |
1011 continue |
1009 # If keep is an option, just do it. |
1012 # If keep is an option, just do it. |
1010 if 'k' in bids: |
1013 if 'k' in bids: |
1011 repo.ui.note(_(" %s: picking 'keep' action\n") % f) |
1014 repo.ui.note(_(" %s: picking 'keep' action\n") % f) |
1012 actions[f] = bids['k'][0] |
1015 actions[f] = bids['k'][0] |
1027 # Pick random action. TODO: Instead, prompt user when resolving |
1030 # Pick random action. TODO: Instead, prompt user when resolving |
1028 m, l = bids.items()[0] |
1031 m, l = bids.items()[0] |
1029 repo.ui.warn(_(' %s: ambiguous merge - picked %s action\n') % |
1032 repo.ui.warn(_(' %s: ambiguous merge - picked %s action\n') % |
1030 (f, m)) |
1033 (f, m)) |
1031 actions[f] = l[0] |
1034 actions[f] = l[0] |
|
1035 if m == 'dm': |
|
1036 dms.append(f) |
1032 continue |
1037 continue |
|
1038 # Work around 'dm' that can cause multiple actions for the same file |
|
1039 for f in dms: |
|
1040 dm, (f0, flags), msg = actions[f] |
|
1041 assert dm == 'dm', dm |
|
1042 m, args, msg = actions[f0] |
|
1043 if m == 'r': |
|
1044 # We have one bid for removing a file and another for moving it. |
|
1045 # These two could be merged as first move and then delete ... |
|
1046 # but instead drop moving and just delete. |
|
1047 del actions[f] |
1033 repo.ui.note(_('end of auction\n\n')) |
1048 repo.ui.note(_('end of auction\n\n')) |
1034 |
1049 |
1035 _resolvetrivial(repo, wctx, mctx, ancestors[0], actions) |
1050 _resolvetrivial(repo, wctx, mctx, ancestors[0], actions) |
1036 |
1051 |
1037 if wctx.rev() is None: |
1052 if wctx.rev() is None: |