[PATCH] mq: include involved files in qrefresh -e constructed message (issue3647)

Kevin Bullock kbullock+mercurial at ringworld.org
Mon Dec 3 23:00:54 CST 2012


On Dec 3, 2012, at 6:45 PM, Davide Bolcioni wrote:

> # HG changeset patch
> # User Davide Bolcioni <dbolcioni at fb.com>
> # Date 1354053904 28800
> # Node ID 85615e499caecbaf758363fd90ad52b42e118a1c
> # Parent  fb14a5dcdc62987512820531fe60719d650491b6
> mq: include involved files in qrefresh -e constructed message (issue3647)

I'm +1 on the idea, but...

> diff --git a/hgext/mq.py b/hgext/mq.py
> --- a/hgext/mq.py
> +++ b/hgext/mq.py
> @@ -2482,9 +2482,33 @@
>             raise util.Abort(_('option "-e" incompatible with "-m" or "-l"'))
>         patch = q.applied[-1].name
>         ph = patchheader(q.join(patch), q.plainmode)
> -        message = ui.edit('\n'.join(ph.message), ph.user or ui.username())
> +
> +        (modified, added, removed, deleted) = repo.status()[:4]
> +        msg = []
> +
> +        if ph.message:
> +            msg.extend(ph.message)
> +
> +        if not msg:
> +            msg.append(_('(replace this line with the message)'))

We don't fill in a placeholder message for commit, why should qrefresh -e be any different?

> +
> +        if msg[-1]:
> +            msg.append("")
> +
> +        msg.append(_("HG: Lines beginning with 'HG:' are removed."))
> +
> +        msg.extend([_('HG: added %s') % f for f in added])
> +        msg.extend([_('HG: changed %s') % f for f in modified])
> +        msg.extend([_('HG: removed %s') % f for f in removed])
> +        msg.extend([_('HG: deleted %s') % f for f in deleted])
> +
> +        message = ui.edit('\n'.join(msg), ph.user or ui.username())
>         # We don't want to lose the patch message if qrefresh fails (issue2062)
> +        msg = [t for t in message.split('\n') if not t.startswith('HG: ')]

Ugh, extending the message just to split and filter it back out again?

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list