hgext/histedit.py
changeset 43105 649d3ac37a12
parent 43089 c59eb1560c44
child 43117 8ff1ecfadcd1
equal deleted inserted replaced
43104:74802979dd9d 43105:649d3ac37a12
  2011     """This action runs when histedit is finishing its session"""
  2011     """This action runs when histedit is finishing its session"""
  2012     hg.updaterepo(repo, state.parentctxnode, overwrite=False)
  2012     hg.updaterepo(repo, state.parentctxnode, overwrite=False)
  2013 
  2013 
  2014     mapping, tmpnodes, created, ntm = processreplacement(state)
  2014     mapping, tmpnodes, created, ntm = processreplacement(state)
  2015     if mapping:
  2015     if mapping:
  2016         for prec, succs in mapping.iteritems():
  2016         for prec, succs in pycompat.iteritems(mapping):
  2017             if not succs:
  2017             if not succs:
  2018                 ui.debug(b'histedit: %s is dropped\n' % node.short(prec))
  2018                 ui.debug(b'histedit: %s is dropped\n' % node.short(prec))
  2019             else:
  2019             else:
  2020                 ui.debug(
  2020                 ui.debug(
  2021                     b'histedit: %s is replaced by %s\n'
  2021                     b'histedit: %s is replaced by %s\n'
  2049     fl = fm.formatlist
  2049     fl = fm.formatlist
  2050     fd = fm.formatdict
  2050     fd = fm.formatdict
  2051     nodechanges = fd(
  2051     nodechanges = fd(
  2052         {
  2052         {
  2053             hf(oldn): fl([hf(n) for n in newn], name=b'node')
  2053             hf(oldn): fl([hf(n) for n in newn], name=b'node')
  2054             for oldn, newn in mapping.iteritems()
  2054             for oldn, newn in pycompat.iteritems(mapping)
  2055         },
  2055         },
  2056         key=b"oldnode",
  2056         key=b"oldnode",
  2057         value=b"newnodes",
  2057         value=b"newnodes",
  2058     )
  2058     )
  2059     fm.data(nodechanges=nodechanges)
  2059     fm.data(nodechanges=nodechanges)
  2309                     act.verb = fword
  2309                     act.verb = fword
  2310                     # get the target summary
  2310                     # get the target summary
  2311                     tsum = summary[len(fword) + 1 :].lstrip()
  2311                     tsum = summary[len(fword) + 1 :].lstrip()
  2312                     # safe but slow: reverse iterate over the actions so we
  2312                     # safe but slow: reverse iterate over the actions so we
  2313                     # don't clash on two commits having the same summary
  2313                     # don't clash on two commits having the same summary
  2314                     for na, l in reversed(list(newact.iteritems())):
  2314                     for na, l in reversed(list(pycompat.iteritems(newact))):
  2315                         actx = repo[na.node]
  2315                         actx = repo[na.node]
  2316                         asum = _getsummary(actx)
  2316                         asum = _getsummary(actx)
  2317                         if asum == tsum:
  2317                         if asum == tsum:
  2318                             added = True
  2318                             added = True
  2319                             l.append(act)
  2319                             l.append(act)
  2322             if not added:
  2322             if not added:
  2323                 newact[act] = []
  2323                 newact[act] = []
  2324 
  2324 
  2325         # copy over and flatten the new list
  2325         # copy over and flatten the new list
  2326         actions = []
  2326         actions = []
  2327         for na, l in newact.iteritems():
  2327         for na, l in pycompat.iteritems(newact):
  2328             actions.append(na)
  2328             actions.append(na)
  2329             actions += l
  2329             actions += l
  2330 
  2330 
  2331     rules = b'\n'.join([act.torule() for act in actions])
  2331     rules = b'\n'.join([act.torule() for act in actions])
  2332     rules += b'\n\n'
  2332     rules += b'\n\n'