[PATCH] histedit: dropmissing hint

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sat Mar 19 02:01:27 EDT 2016



On 03/18/2016 06:56 PM, Mateusz Kwapich wrote:
> # HG changeset patch
> # User Mateusz Kwapich <mitrandir at fb.com>
> # Date 1458352398 25200
> #      Fri Mar 18 18:53:18 2016 -0700
> # Node ID f1d58b17008f050228c22f4a23cceb8074fe6106
> # Parent  dfb21c34e07dfeeccb9be6197ad15733ee53a48e
> histedit: dropmissing hint
>
> Adds a hint to histedit comment reminding user about enabled dropmissing

Thanks for making this more explicite, but can we get an upgraded commit 
description:
- a more verbose summary line,
- the new example output,
- some rational for the change.

Thanks.

> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -220,13 +220,14 @@ secondaryactions = set()
>   tertiaryactions = set()
>   internalactions = set()
>
> -def geteditcomment(first, last):
> +def geteditcomment(ui, first, last):
>       """ construct the editor comment
>       The comment includes::
>        - an intro
>        - sorted primary commands
>        - sorted short commands
>        - sorted long commands
> +     - additional hints
>
>       Commands are only included once.
>       """
> @@ -255,8 +256,14 @@ Commands:
>           addverb(v)
>       actions.append('')
>
> -    return ''.join(['# %s\n' % l if l else '#\n'
> -                    for l in ((intro % (first, last)).split('\n')) + actions])
> +    hints = []
> +    if ui.configbool('histedit', 'dropmissing'):
> +        hints.append("Deleting a changeset from the list "
> +                     "will DISCARD it from the edited history!")
> +
> +    lines = (intro % (first, last)).split('\n') + actions + hints
> +
> +    return ''.join(['# %s\n' % l if l else '#\n' for l in lines])
>
>   class histeditstate(object):
>       def __init__(self, repo, parentctxnode=None, actions=None, keep=None,
> @@ -1186,7 +1193,8 @@ def _aborthistedit(ui, repo, state):
>   def _edithisteditplan(ui, repo, state, rules):
>       state.read()
>       if not rules:
> -        comment = geteditcomment(node.short(state.parentctxnode),
> +        comment = geteditcomment(ui,
> +                                 node.short(state.parentctxnode),
>                                    node.short(state.topmost))
>           rules = ruleeditor(repo, ui, state.actions, comment)
>       else:
> @@ -1232,7 +1240,7 @@ def _newhistedit(ui, repo, state, revs,
>
>       ctxs = [repo[r] for r in revs]
>       if not rules:
> -        comment = geteditcomment(node.short(root), node.short(topmost))
> +        comment = geteditcomment(ui, node.short(root), node.short(topmost))
>           actions = [pick(state, r) for r in revs]
>           rules = ruleeditor(repo, ui, actions, comment)
>       else:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list