hgext/histedit.py
changeset 48913 f254fc73d956
parent 48875 6000f5b25c9b
child 48946 642e31cb55f0
equal deleted inserted replaced
48912:a0674e916fb6 48913:f254fc73d956
  2099     """This action runs when histedit is finishing its session"""
  2099     """This action runs when histedit is finishing its session"""
  2100     mergemod.update(repo[state.parentctxnode])
  2100     mergemod.update(repo[state.parentctxnode])
  2101 
  2101 
  2102     mapping, tmpnodes, created, ntm = processreplacement(state)
  2102     mapping, tmpnodes, created, ntm = processreplacement(state)
  2103     if mapping:
  2103     if mapping:
  2104         for prec, succs in pycompat.iteritems(mapping):
  2104         for prec, succs in mapping.items():
  2105             if not succs:
  2105             if not succs:
  2106                 ui.debug(b'histedit: %s is dropped\n' % short(prec))
  2106                 ui.debug(b'histedit: %s is dropped\n' % short(prec))
  2107             else:
  2107             else:
  2108                 ui.debug(
  2108                 ui.debug(
  2109                     b'histedit: %s is replaced by %s\n'
  2109                     b'histedit: %s is replaced by %s\n'
  2137     fl = fm.formatlist
  2137     fl = fm.formatlist
  2138     fd = fm.formatdict
  2138     fd = fm.formatdict
  2139     nodechanges = fd(
  2139     nodechanges = fd(
  2140         {
  2140         {
  2141             hf(oldn): fl([hf(n) for n in newn], name=b'node')
  2141             hf(oldn): fl([hf(n) for n in newn], name=b'node')
  2142             for oldn, newn in pycompat.iteritems(mapping)
  2142             for oldn, newn in mapping.items()
  2143         },
  2143         },
  2144         key=b"oldnode",
  2144         key=b"oldnode",
  2145         value=b"newnodes",
  2145         value=b"newnodes",
  2146     )
  2146     )
  2147     fm.data(nodechanges=nodechanges)
  2147     fm.data(nodechanges=nodechanges)
  2385                     act.verb = fword
  2385                     act.verb = fword
  2386                     # get the target summary
  2386                     # get the target summary
  2387                     tsum = summary[len(fword) + 1 :].lstrip()
  2387                     tsum = summary[len(fword) + 1 :].lstrip()
  2388                     # safe but slow: reverse iterate over the actions so we
  2388                     # safe but slow: reverse iterate over the actions so we
  2389                     # don't clash on two commits having the same summary
  2389                     # don't clash on two commits having the same summary
  2390                     for na, l in reversed(list(pycompat.iteritems(newact))):
  2390                     for na, l in reversed(list(newact.items())):
  2391                         actx = repo[na.node]
  2391                         actx = repo[na.node]
  2392                         asum = _getsummary(actx)
  2392                         asum = _getsummary(actx)
  2393                         if asum == tsum:
  2393                         if asum == tsum:
  2394                             added = True
  2394                             added = True
  2395                             l.append(act)
  2395                             l.append(act)
  2398             if not added:
  2398             if not added:
  2399                 newact[act] = []
  2399                 newact[act] = []
  2400 
  2400 
  2401         # copy over and flatten the new list
  2401         # copy over and flatten the new list
  2402         actions = []
  2402         actions = []
  2403         for na, l in pycompat.iteritems(newact):
  2403         for na, l in newact.items():
  2404             actions.append(na)
  2404             actions.append(na)
  2405             actions += l
  2405             actions += l
  2406 
  2406 
  2407     rules = b'\n'.join([act.torule() for act in actions])
  2407     rules = b'\n'.join([act.torule() for act in actions])
  2408     rules += b'\n\n'
  2408     rules += b'\n\n'