Mercurial > hg
changeset 25898:4dcc9b5d786a
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.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 03 Aug 2015 14:16:51 -0700 |
parents | d6106df97edd |
children | c35ee1bbbbdc |
files | hgext/histedit.py |
diffstat | 1 files changed, 20 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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