histedit: unifying the way replacements are computed for abort and success
authorKostia Balytskyi <ikostia@fb.com>
Tue, 16 Feb 2016 14:49:29 +0000
changeset 28179 2e11f6756d9c
parent 28178 96f2d50fb9f6
child 28180 2836a43c7722
histedit: unifying the way replacements are computed for abort and success This is a part of a bigger refactoring effort with the ultimate goal of better understanding of how histedit works and fixing issue4800.
hgext/histedit.py
--- a/hgext/histedit.py	Fri Feb 12 18:39:48 2016 +0900
+++ b/hgext/histedit.py	Tue Feb 16 14:49:29 2016 +0000
@@ -1147,7 +1147,7 @@
 def _aborthistedit(ui, repo, state):
     try:
         state.read()
-        tmpnodes, leafs = newnodestoabort(state)
+        __, leafs, tmpnodes, __ = processreplacement(state)
         ui.debug('restore wc to old parent %s\n'
                 % node.short(state.topmost))
 
@@ -1386,25 +1386,6 @@
                 hint=_('use "drop %s" to discard, see also: '
                        '"hg help -e histedit.config"') % missing[0][:12])
 
-def newnodestoabort(state):
-    """process the list of replacements to return
-
-    1) the list of final node
-    2) the list of temporary node
-
-    This is meant to be used on abort as less data are required in this case.
-    """
-    replacements = state.replacements
-    allsuccs = set()
-    replaced = set()
-    for rep in replacements:
-        allsuccs.update(rep[1])
-        replaced.add(rep[0])
-    newnodes = allsuccs - replaced
-    tmpnodes = allsuccs & replaced
-    return newnodes, tmpnodes
-
-
 def processreplacement(state):
     """process the list of replacements to return