mercurial/merge.py
changeset 48711 9bc86adf32f6
parent 48708 25d5dffbb211
child 48713 5dfaca4464d1
equal deleted inserted replaced
48710:b0aa9b0b9c21 48711:9bc86adf32f6
  1199             # we will need to make commitinfo also depend on bid merge logic
  1199             # we will need to make commitinfo also depend on bid merge logic
  1200             mresult._commitinfo.update(mresult1._commitinfo)
  1200             mresult._commitinfo.update(mresult1._commitinfo)
  1201 
  1201 
  1202             for f, a in mresult1.filemap(sort=True):
  1202             for f, a in mresult1.filemap(sort=True):
  1203                 m, args, msg = a
  1203                 m, args, msg = a
  1204                 repo.ui.debug(b' %s: %s -> %s\n' % (f, msg, m))
  1204                 repo.ui.debug(b' %s: %s -> %s\n' % (f, msg, m.__bytes__()))
  1205                 if f in fbids:
  1205                 if f in fbids:
  1206                     d = fbids[f]
  1206                     d = fbids[f]
  1207                     if m in d:
  1207                     if m in d:
  1208                         d[m].append(a)
  1208                         d[m].append(a)
  1209                     else:
  1209                     else:
  1220         for f, bids in sorted(fbids.items()):
  1220         for f, bids in sorted(fbids.items()):
  1221             if repo.ui.debugflag:
  1221             if repo.ui.debugflag:
  1222                 repo.ui.debug(b" list of bids for %s:\n" % f)
  1222                 repo.ui.debug(b" list of bids for %s:\n" % f)
  1223                 for m, l in sorted(bids.items()):
  1223                 for m, l in sorted(bids.items()):
  1224                     for _f, args, msg in l:
  1224                     for _f, args, msg in l:
  1225                         repo.ui.debug(b'   %s -> %s\n' % (msg, m))
  1225                         repo.ui.debug(b'   %s -> %s\n' % (msg, m.__bytes__()))
  1226             # bids is a mapping from action method to list af actions
  1226             # bids is a mapping from action method to list af actions
  1227             # Consensus?
  1227             # Consensus?
  1228             if len(bids) == 1:  # all bids are the same kind of method
  1228             if len(bids) == 1:  # all bids are the same kind of method
  1229                 m, l = list(bids.items())[0]
  1229                 m, l = list(bids.items())[0]
  1230                 if all(a == l[0] for a in l[1:]):  # len(bids) is > 1
  1230                 if all(a == l[0] for a in l[1:]):  # len(bids) is > 1
  1231                     repo.ui.note(_(b" %s: consensus for %s\n") % (f, m))
  1231                     repo.ui.note(
       
  1232                         _(b" %s: consensus for %s\n") % (f, m.__bytes__())
       
  1233                     )
  1232                     mresult.addfile(f, *l[0])
  1234                     mresult.addfile(f, *l[0])
  1233                     continue
  1235                     continue
  1234             # If keep is an option, just do it.
  1236             # If keep is an option, just do it.
  1235             if mergestatemod.ACTION_KEEP in bids:
  1237             if mergestatemod.ACTION_KEEP in bids:
  1236                 repo.ui.note(_(b" %s: picking 'keep' action\n") % f)
  1238                 repo.ui.note(_(b" %s: picking 'keep' action\n") % f)
  1284             # TODO: Consider other simple actions such as mode changes
  1286             # TODO: Consider other simple actions such as mode changes
  1285             # Handle inefficient democrazy.
  1287             # Handle inefficient democrazy.
  1286             repo.ui.note(_(b' %s: multiple bids for merge action:\n') % f)
  1288             repo.ui.note(_(b' %s: multiple bids for merge action:\n') % f)
  1287             for m, l in sorted(bids.items()):
  1289             for m, l in sorted(bids.items()):
  1288                 for _f, args, msg in l:
  1290                 for _f, args, msg in l:
  1289                     repo.ui.note(b'  %s -> %s\n' % (msg, m))
  1291                     repo.ui.note(b'  %s -> %s\n' % (msg, m.__bytes__()))
  1290             # Pick random action. TODO: Instead, prompt user when resolving
  1292             # Pick random action. TODO: Instead, prompt user when resolving
  1291             m, l = list(bids.items())[0]
  1293             m, l = list(bids.items())[0]
  1292             repo.ui.warn(
  1294             repo.ui.warn(
  1293                 _(b' %s: ambiguous merge - picked %s action\n') % (f, m)
  1295                 _(b' %s: ambiguous merge - picked %s action\n')
       
  1296                 % (f, m.__bytes__())
  1294             )
  1297             )
  1295             mresult.addfile(f, *l[0])
  1298             mresult.addfile(f, *l[0])
  1296             continue
  1299             continue
  1297         repo.ui.note(_(b'end of auction\n\n'))
  1300         repo.ui.note(_(b'end of auction\n\n'))
  1298         mresult.updatevalues(diverge, renamedelete)
  1301         mresult.updatevalues(diverge, renamedelete)
  1621         progress.increment(item=f)
  1624         progress.increment(item=f)
  1622 
  1625 
  1623     # keep (noop, just log it)
  1626     # keep (noop, just log it)
  1624     for a in mergestatemod.NO_OP_ACTIONS:
  1627     for a in mergestatemod.NO_OP_ACTIONS:
  1625         for f, args, msg in mresult.getactions((a,), sort=True):
  1628         for f, args, msg in mresult.getactions((a,), sort=True):
  1626             repo.ui.debug(b" %s: %s -> %s\n" % (f, msg, a))
  1629             repo.ui.debug(b" %s: %s -> %s\n" % (f, msg, a.__bytes__()))
  1627             # no progress
  1630             # no progress
  1628 
  1631 
  1629     # directory rename, move local
  1632     # directory rename, move local
  1630     for f, args, msg in mresult.getactions(
  1633     for f, args, msg in mresult.getactions(
  1631         (mergestatemod.ACTION_DIR_RENAME_MOVE_LOCAL,), sort=True
  1634         (mergestatemod.ACTION_DIR_RENAME_MOVE_LOCAL,), sort=True