[PATCH 5 of 5] histedit: break _histedit function into smaller pieces (add _continueaction)

Kostia Balytskyi ikostia at fb.com
Fri Feb 5 18:04:24 EST 2016


Sorry, the explanation was meant to be in Patch 0 before I learned that hg mailing list does not like those. The ultimate goal for me is to fix issue4800. I tried to send the easy patch once, but Pierre-Eves did not like it. His suggestion on fixing that requires much deeper understanding of how histedit works from me and while I'm trying to figure that out, I'm refactoring in process. I've been told that it's a good thing :)




On 2/5/16, 9:50 PM, "Augie Fackler" <raf at durin42.com> wrote:

>On Tue, Feb 02, 2016 at 07:28:06PM +0000, Kostia Balytskyi wrote:
>> # HG changeset patch
>> # User Kostia Balytskyi <ikostia at fb.com>
>> # Date 1454348814 0
>> #      Mon Feb 01 17:46:54 2016 +0000
>> # Branch stable
>> # Node ID a6d5d9f5a18ccc250176665cb67f3d018249958a
>> # Parent  55512493bd388e75f3d6187a9562330ddc3474e9
>> histedit: break _histedit function into smaller pieces (add _continueaction)
>
>For the most part I like this, but where is this going? I'm just not seeing the forest in these trees yet...
>
>>
>> diff --git a/hgext/histedit.py b/hgext/histedit.py
>> --- a/hgext/histedit.py
>> +++ b/hgext/histedit.py
>> @@ -1057,23 +1057,29 @@
>>      goal = _getgoal(opts)
>>      revs = _validateargs(ui, repo, state, goal, freeargs, opts)
>>
>> -    replacements = []
>>      state.keep = opts.get('keep', False)
>> -    supportsmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt)
>>
>>      # rebuild state
>> -    if goal == 'continue':
>> +    if Goal.EDITPLAN == goal:
>> +        _editplanaction(ui, repo, state, rules)
>> +        return
>> +    elif Goal.ABORT == goal:
>> +        _abortaction(ui, repo, state)
>> +        return
>> +    elif Goal.CONTINUE == goal:
>>          state.read()
>>          state = bootstrapcontinue(ui, state, opts)
>> -    elif goal == 'edit-plan':
>> -        _editplanaction(ui, repo, state, rules)
>> -        return
>> -    elif goal == 'abort':
>> -        _abortaction(ui, repo, state)
>> -        return
>>      else:
>> +        # Goal.NEW == goal
>>          _newaction(ui, repo, state, revs, freeargs, opts)
>>
>> +    _continueaction(ui, repo, state)
>> +
>> +def _continueaction(ui, repo, state):
>> +    """This action runs after either:
>> +    -bootstrapcontinue (if goal is CONTINUE)
>> +    -_newaction (if goal is NEW)
>> +    """
>>      # preprocess rules so that we can hide inner folds from the user
>>      # and only show one editor
>>      actions = state.actions[:]
>> @@ -1113,6 +1119,7 @@
>>                      for n in succs[1:]:
>>                          ui.debug(m % node.short(n))
>>
>> +    supportsmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt)
>>      if supportsmarkers:
>>          # Only create markers if the temp nodes weren't already removed.
>>          obsolete.createmarkers(repo, ((repo[t],()) for t in sorted(tmpnodes)
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel at mercurial-scm.org
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__www.mercurial-2Dscm.org_mailman_listinfo_mercurial-2Ddevel&d=CwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=Pp-gQYFgs4tKlSFPF5kfCw&m=lYeAcuiBNWl_3xwn2vpZ7SB4n6En3GxOlhyLaa4uXD0&s=m859acpjjPdsIlwyRVA0YNlEWybFv7N8sN4wUt6gJM0&e= 


More information about the Mercurial-devel mailing list