# HG changeset patch # User Pierre-Yves David # Date 1438636611 25200 # Node ID 4dcc9b5d786a5f549bf999d0ca9e9babd27f93e4 # Parent d6106df97eddf20cf1a4c06dd3f0e77f9316442d histedit: extract a simpler function to process replacement on abort The process replacement is building a full mapping to allow moving bookmarks and creating obsolescence marker. We do not need the full logic for abort so we extract it. It will be useful as abort is missing some data about the replacement and can crash when third party extensions push it a bit too far. diff -r d6106df97edd -r 4dcc9b5d786a hgext/histedit.py --- a/hgext/histedit.py Mon Aug 03 14:05:42 2015 -0700 +++ b/hgext/histedit.py Mon Aug 03 14:16:51 2015 -0700 @@ -778,7 +778,7 @@ return elif goal == 'abort': state.read() - mapping, tmpnodes, leafs, _ntm = processreplacement(state) + tmpnodes, leafs = newnodestoabort(state) ui.debug('restore wc to old parent %s\n' % node.short(state.topmost)) # Recover our old commits if necessary @@ -1009,6 +1009,25 @@ hint=_('do you want to use the drop action?')) return parsed +def newnodestoabort(state): + """process the list of replacements to return + + 1) the list of final node + 2) the list of temporary node + + This 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