[PATCH 1 of 2 V2] histedit: add optional parameter for determining intial editor line

timeless timeless at gmail.com
Tue May 17 19:57:38 EDT 2016


I was expecting to see a test or some code that exercises this...

On Tue, May 17, 2016 at 7:12 PM, Sean Farley <sean at farley.io> wrote:
> # HG changeset patch
> # User Sean Farley <sean at farley.io>
> # Date 1462582803 25200
> #      Fri May 06 18:00:03 2016 -0700
> # Node ID d4c7748adeeadbb736376a57030c5255f3ac8bfb
> # Parent  fe50341de1fff843ae633d7ad7be908100c09cdc
> # EXP-Topic histedit-auto
> histedit: add optional parameter for determining intial editor line
>
> A simple refactor to allow us to change the default verb for the initial editor
> display.
>
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -406,11 +406,11 @@ class histeditaction(object):
>              self.node = repo[ha].node()
>          except error.RepoError:
>              raise error.ParseError(_('unknown changeset %s listed')
>                                % ha[:12])
>
> -    def torule(self):
> +    def torule(self, initial=False):
>          """build a histedit rule line for an action
>
>          by default lines are in the form:
>          <hash> <rev> <summary>
>          """
> @@ -1302,11 +1302,11 @@ def between(repo, old, new, keep):
>  def ruleeditor(repo, ui, actions, editcomment=""):
>      """open an editor to edit rules
>
>      rules are in the format [ [act, ctx], ...] like in state.rules
>      """
> -    rules = '\n'.join([act.torule() for act in actions])
> +    rules = '\n'.join([act.torule(initial=True) for act in actions])
>      rules += '\n\n'
>      rules += editcomment
>      rules = ui.edit(rules, ui.username(), {'prefix': 'histedit'})
>
>      # Save edit rules in .hg/histedit-last-edit.txt in case
> _______________________________________________
> 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