[PATCH] qfold: suppress "* * *" if the current message is empty

Steve Borho steve at borho.org
Wed Mar 16 19:30:10 CDT 2011


On Wed, Mar 16, 2011 at 7:26 PM, timeless <timeless at gmail.com> wrote:
> # HG changeset patch
> # User timeless <timeless at gmail.com>
> # Date 1300320012 -3600
> # Node ID 53400fc0b21cf9ee04e3b705748b52ca7a483aa9
> # Parent  0652b2da832daada866a68f7a4359227570c2447
> qfold: suppress "* * *" if the current message is empty
>
> diff --git a/hgext/mq.py b/hgext/mq.py
> --- a/hgext/mq.py
> +++ b/hgext/mq.py
> @@ -2199,7 +2199,8 @@ def fold(ui, repo, *files, **opts):
>     removed afterwards.
>
>     The header for each folded patch will be concatenated with the
> -    current patch header, separated by a line of ``* * *``.
> +    current patch header, separating non empty messages with
> +    a line of ``* * *``.
>
>     Returns 0 on success."""
>
> @@ -2242,7 +2243,8 @@ def fold(ui, repo, *files, **opts):
>         ph = patchheader(q.join(parent), q.plainmode)
>         message, user = ph.message, ph.user
>         for msg in messages:
> -            message.append('* * *')
> +            if message:
> +                message.append('* * *')
>             message.extend(msg)
>         message = '\n'.join(message)

This looks like it wants to be a "* * *\n".join([msg for msg in
messages if msg])

> diff --git a/tests/test-mq-qfold.t b/tests/test-mq-qfold.t
> --- a/tests/test-mq-qfold.t
> +++ b/tests/test-mq-qfold.t
> @@ -19,6 +19,16 @@ init:
>   $ echo c >> a
>   $ hg qnew -f p3
>
> +Fold message onto no message:
> +
> +  $ hg qnew -f p4 -m 'message'
> +  $ hg qpop
> +  popping p4
> +  now at: p3
> +  $ hg qfold p4
> +  $ hg qtop -s
> +  p3: message
> +
>  Fold in the middle of the queue:
>
>   $ hg qpop p1
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>



-- 
Steve Borho


More information about the Mercurial-devel mailing list