hgext/histedit.py
changeset 25898 4dcc9b5d786a
parent 25894 54f9561088c7
child 25906 5d0e1e95e30f
equal deleted inserted replaced
25897:d6106df97edd 25898:4dcc9b5d786a
   776         state.rules = rules
   776         state.rules = rules
   777         state.write()
   777         state.write()
   778         return
   778         return
   779     elif goal == 'abort':
   779     elif goal == 'abort':
   780         state.read()
   780         state.read()
   781         mapping, tmpnodes, leafs, _ntm = processreplacement(state)
   781         tmpnodes, leafs = newnodestoabort(state)
   782         ui.debug('restore wc to old parent %s\n' % node.short(state.topmost))
   782         ui.debug('restore wc to old parent %s\n' % node.short(state.topmost))
   783 
   783 
   784         # Recover our old commits if necessary
   784         # Recover our old commits if necessary
   785         if not state.topmost in repo and state.backupfile:
   785         if not state.topmost in repo and state.backupfile:
   786             backupfile = repo.join(state.backupfile)
   786             backupfile = repo.join(state.backupfile)
  1006     if missing:
  1006     if missing:
  1007         raise util.Abort(_('missing rules for changeset %s') %
  1007         raise util.Abort(_('missing rules for changeset %s') %
  1008                 missing[0][:12],
  1008                 missing[0][:12],
  1009                 hint=_('do you want to use the drop action?'))
  1009                 hint=_('do you want to use the drop action?'))
  1010     return parsed
  1010     return parsed
       
  1011 
       
  1012 def newnodestoabort(state):
       
  1013     """process the list of replacements to return
       
  1014 
       
  1015     1) the list of final node
       
  1016     2) the list of temporary node
       
  1017 
       
  1018     This meant to be used on abort as less data are required in this case.
       
  1019     """
       
  1020     replacements = state.replacements
       
  1021     allsuccs = set()
       
  1022     replaced = set()
       
  1023     for rep in replacements:
       
  1024         allsuccs.update(rep[1])
       
  1025         replaced.add(rep[0])
       
  1026     newnodes = allsuccs - replaced
       
  1027     tmpnodes = allsuccs & replaced
       
  1028     return newnodes, tmpnodes
       
  1029 
  1011 
  1030 
  1012 def processreplacement(state):
  1031 def processreplacement(state):
  1013     """process the list of replacements to return
  1032     """process the list of replacements to return
  1014 
  1033 
  1015     1) the final mapping between original and created nodes
  1034     1) the final mapping between original and created nodes