[PATCH resend] histedit: use descriptive comments to combine commit messages in fold

Kevin Bullock kbullock+mercurial at ringworld.org
Tue Jan 15 14:08:39 CST 2013


On Jan 15, 2013, at 8:34 AM, Denis Laxalde wrote:

> # HG changeset patch
> # User Denis Laxalde <denis at laxalde.org>
> # Date 1357565293 -3600
> # Node ID a522e70fa65d58f667bd8de4162c6eeb67f46b3a
> # Parent  83e8f22da9c2895f8cb0c7a8662e064477d63538
> histedit: use descriptive comments to combine commit messages in fold
> 
> The combined template message resulting from a fold in histedit is made of
> comments (i.e. "HG: [...]") intercalated between commit messages of folded
> changesets instead of the previous "***".

What happens when I don't edit the message, save, and quit my editor? Does the commit message include the new 'HG: ' lines, or the same '***' as before, or just no separation?

> Tests updated.
> 
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -324,11 +324,11 @@ def finishfold(ui, repo, ctx, oldctx, ne
>         username = ui.username()
>     commitopts['user'] = username
>     # commit message
> -    newmessage = '\n***\n'.join(
> -        [ctx.description()] +
> -        [repo[r].description() for r in internalchanges] +
> -        [oldctx.description()]) + '\n'
> -    commitopts['message'] = newmessage
> +    allctx = [ctx] + [repo[r] for r in internalchanges] + [oldctx]
> +    newmessage = ["HG: This is a fold of %d changesets." % len(allctx)]
> +    newmessage += ["HG: Commit message of changeset %s.\n\n%s\n" %
> +                   (c.rev(), c.description()) for c in allctx]
> +    commitopts['message'] = "\n".join(newmessage)
>     # date
>     commitopts['date'] = max(ctx.date(), oldctx.date())
>     n = collapse(repo, ctx, repo[newnode], commitopts)
> diff --git a/tests/test-histedit-fold-non-commute.t b/tests/test-histedit-fold-non-commute.t
> --- a/tests/test-histedit-fold-non-commute.t
> +++ b/tests/test-histedit-fold-non-commute.t
> @@ -104,8 +104,13 @@ fix up
>   > EOF
>   $ HGEDITOR="python cat.py" hg histedit --continue 2>&1 | fixbundle | grep -v '2 files removed'
>   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  HG: This is a fold of 2 changesets.
> +  HG: Commit message of changeset 4.
> +     d
> -  ***
> +  +  HG: Commit message of changeset 7.
> +     does not commute with e

I'd rather this give the short node ID, like histedit does in the initial change selection.

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



More information about the Mercurial-devel mailing list