[PATCH 5 of 6] histedit: improve roll action integration with fold

Alexander Drozdov al.drozdov at gmail.com
Mon Apr 20 03:05:03 CDT 2015


On 16.04.2015 01:55:55 +0300 Durham Goode <durham at fb.com> wrote:
> # HG changeset patch
> # User Durham Goode <durham at fb.com>
> # Date 1428138773 25200
> #      Sat Apr 04 02:12:53 2015 -0700
> # Node ID bf0fdb475857f76b895f799f18ad235a7cb923f2
> # Parent  8416499cacc7b83e364bbd8eaed3b464e229cecd
> histedit: improve roll action integration with fold
>
> Previously the fold action would inspect it's class to figure out if it was a
> rollup or not. This was hacky. Now that finishfold is inside the fold class,
> let's modify it to check a function (which roll can override) to determine if it
> should be prompting for a commit message.

'hg bisect' shows that this revision makes 'roll' command to call an editor,
but it shouldn't.

>
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -475,21 +475,20 @@ class fold(histeditaction):
>           middlecommits = newcommits.copy()
>           middlecommits.discard(ctx.node())
>
> -        foldopts = {}
> -        if isinstance(self, rollup):
> -            foldopts['rollup'] = True
> +        return self.finishfold(repo.ui, repo, parentctx, rulectx, ctx.node(),
> +                               middlecommits)
>
> -        return self.finishfold(repo.ui, repo, parentctx, rulectx, ctx.node(),
> -                               foldopts, middlecommits)
> +    def skipprompt(self):
> +        return False
>
> -    def finishfold(self, ui, repo, ctx, oldctx, newnode, opts, internalchanges):
> +    def finishfold(self, ui, repo, ctx, oldctx, newnode, internalchanges):
>           parent = ctx.parents()[0].node()
>           hg.update(repo, parent)
>           ### prepare new commit data
> -        commitopts = opts.copy()
> +        commitopts = {}
>           commitopts['user'] = ctx.user()
>           # commit message
> -        if opts.get('rollup'):
> +        if self.skipprompt():
>               newmessage = ctx.description()
>           else:
>               newmessage = '\n***\n'.join(
> @@ -524,7 +523,8 @@ class fold(histeditaction):
>           return repo[n], replacements
>
>   class rollup(fold):
> -    pass
> +    def skipprompt(self):
> +        return True
>
>   class drop(histeditaction):
>       def run(self):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>


More information about the Mercurial-devel mailing list