hgext/histedit.py
changeset 28179 2e11f6756d9c
parent 28154 47f56b6bfed1
child 28216 eed7d8c07c20
equal deleted inserted replaced
28178:96f2d50fb9f6 28179:2e11f6756d9c
  1145         repo.vfs.unlink('histedit-last-edit.txt')
  1145         repo.vfs.unlink('histedit-last-edit.txt')
  1146 
  1146 
  1147 def _aborthistedit(ui, repo, state):
  1147 def _aborthistedit(ui, repo, state):
  1148     try:
  1148     try:
  1149         state.read()
  1149         state.read()
  1150         tmpnodes, leafs = newnodestoabort(state)
  1150         __, leafs, tmpnodes, __ = processreplacement(state)
  1151         ui.debug('restore wc to old parent %s\n'
  1151         ui.debug('restore wc to old parent %s\n'
  1152                 % node.short(state.topmost))
  1152                 % node.short(state.topmost))
  1153 
  1153 
  1154         # Recover our old commits if necessary
  1154         # Recover our old commits if necessary
  1155         if not state.topmost in repo and state.backupfile:
  1155         if not state.topmost in repo and state.backupfile:
  1383     elif missing:
  1383     elif missing:
  1384         raise error.ParseError(_('missing rules for changeset %s') %
  1384         raise error.ParseError(_('missing rules for changeset %s') %
  1385                 missing[0][:12],
  1385                 missing[0][:12],
  1386                 hint=_('use "drop %s" to discard, see also: '
  1386                 hint=_('use "drop %s" to discard, see also: '
  1387                        '"hg help -e histedit.config"') % missing[0][:12])
  1387                        '"hg help -e histedit.config"') % missing[0][:12])
  1388 
       
  1389 def newnodestoabort(state):
       
  1390     """process the list of replacements to return
       
  1391 
       
  1392     1) the list of final node
       
  1393     2) the list of temporary node
       
  1394 
       
  1395     This is meant to be used on abort as less data are required in this case.
       
  1396     """
       
  1397     replacements = state.replacements
       
  1398     allsuccs = set()
       
  1399     replaced = set()
       
  1400     for rep in replacements:
       
  1401         allsuccs.update(rep[1])
       
  1402         replaced.add(rep[0])
       
  1403     newnodes = allsuccs - replaced
       
  1404     tmpnodes = allsuccs & replaced
       
  1405     return newnodes, tmpnodes
       
  1406 
       
  1407 
  1388 
  1408 def processreplacement(state):
  1389 def processreplacement(state):
  1409     """process the list of replacements to return
  1390     """process the list of replacements to return
  1410 
  1391 
  1411     1) the final mapping between original and created nodes
  1392     1) the final mapping between original and created nodes