[PATCH 2 of 2 RFC] histedit: add experimental config for using the first word of the commit

Jun Wu quark at fb.com
Sat May 7 19:20:04 EDT 2016


I like the idea and this looks good to me.

"autohistedit" sounds a bit too broad. But it's in "experimental" so doesn't
matter much. When we move it to "histedit" I vote something like
"histedit.autoverb".


On 05/07/2016 08:02 AM, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean at farley.io>
> # Date 1462583556 25200
> #      Fri May 06 18:12:36 2016 -0700
> # Node ID dd7915236f69edd5f779faec20bd08308a89ed27
> # Parent  d4c7748adeeadbb736376a57030c5255f3ac8bfb
> # EXP-Topic histedit-auto
> histedit: add experimental config for using the first word of the commit
>
> This allows users to start a commit with "roll! foo bar" so that when this is
> opened in histedit, the default action will be "roll". Currently, we'll allow
> any known verb to be used but this is experimental.
>
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -416,10 +416,18 @@ class histeditaction(object):
>          """
>          ctx = self.repo[self.node]
>          summary = ''
>          if ctx.description():
>              summary = ctx.description().splitlines()[0]
> +
> +        fword = summary.split(' ', 1)[0].lower()
> +        # if it doesn't end with the special character '!' just skip this
> +        if (self.repo.ui.configbool("experimental", "autohistedit") and
> +            initial and fword.endswith('!')):
> +            fword = fword[:-1]
> +            if fword in primaryactions | secondaryactions | tertiaryactions:
> +                self.verb = fword
>          line = '%s %s %d %s' % (self.verb, ctx, ctx.rev(), summary)
>          # trim to 75 columns by default so it's not stupidly wide in my editor
>          # (the 5 more are left for verb)
>          maxlen = self.repo.ui.configint('histedit', 'linelen', default=80)
>          maxlen = max(maxlen, 22) # avoid truncating hash


More information about the Mercurial-devel mailing list