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

Augie Fackler raf at durin42.com
Fri Feb 5 16:50:22 EST 2016


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://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list