Patchwork [evolve-ext] split: reuse the pre-split commit message for the split ones

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date March 20, 2016, 10:18 p.m.
Message ID <f3c32a01d13f8bf64d29.1458512333@Iris>
Download mbox | patch
Permalink /patch/13988/
State Superseded
Delegated to: Pierre-Yves David
Headers show

Comments

Jordi Gutiérrez Hermoso - March 20, 2016, 10:18 p.m.
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh@octave.org>
# Date 1458511862 14400
#      Sun Mar 20 18:11:02 2016 -0400
# Node ID f3c32a01d13f8bf64d29a758c6deb6dc8ee90466
# Parent  9bcb24c3ba8d2b5a7082ae61ac2193e867234822
split: reuse the pre-split commit message for the split ones

The original commit message is probably relevant in some way for the
split commit messages. It is helpful for the user to have access to
the pre-split commit message, so we provide the original commit
message. This is more helpful than completely dropping the original
commit message during a split.
Pierre-Yves David - March 22, 2016, 7 p.m.
On 03/20/2016 03:18 PM, Jordi Gutiérrez Hermoso wrote:
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
> # Date 1458511862 14400
> #      Sun Mar 20 18:11:02 2016 -0400
> # Node ID f3c32a01d13f8bf64d29a758c6deb6dc8ee90466
> # Parent  9bcb24c3ba8d2b5a7082ae61ac2193e867234822
> split: reuse the pre-split commit message for the split ones
>
> The original commit message is probably relevant in some way for the
> split commit messages. It is helpful for the user to have access to
> the pre-split commit message, so we provide the original commit
> message. This is more helpful than completely dropping the original
> commit message during a split.

I'm a bit confused here because I -already- see such behavior without 
your patch.

https://www.mercurial-scm.org/repo/evolve/file/9bcb24c3ba8d2b5a7082ae61ac2193e867234822/hgext/evolve.py#l2788

However that aspect seems to be untested, it would be great to add a test.

>
> diff --git a/hgext/evolve.py b/hgext/evolve.py
> --- a/hgext/evolve.py
> +++ b/hgext/evolve.py
> @@ -2766,6 +2766,16 @@ def cmdsplit(ui, repo, *revs, **opts):
>           r = ctx.rev()
>           disallowunstable = not obsolete.isenabled(repo,
>                                                     obsolete.allowunstableopt)
> +
> +        # We'll re-use the same commit message for all split commits,
> +        # as it's a reasonable starting point for writing the commit
> +        # messages for each chunk.
> +        opts['message'] = (
> +            "HG: This is the original pre-split commit message. "
> +            "Edit it as appropriate.\n\n%s"
> +        ) % ctx.description()
> +        opts['edit'] = True
> +
>           if disallowunstable:
>               # XXX We should check head revs
>               if repo.revs("(%d::) - %d", rev, rev):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
Jordi Gutiérrez Hermoso - March 23, 2016, 2:08 a.m.
On Tue, 2016-03-22 at 12:00 -0700, Pierre-Yves David wrote:
> 
> On 03/20/2016 03:18 PM, Jordi Gutiérrez Hermoso wrote:
> > # HG changeset patch
> > # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
> > # Date 1458511862 14400
> > #      Sun Mar 20 18:11:02 2016 -0400
> > # Node ID f3c32a01d13f8bf64d29a758c6deb6dc8ee90466
> > # Parent  9bcb24c3ba8d2b5a7082ae61ac2193e867234822
> > split: reuse the pre-split commit message for the split ones
> >
> > The original commit message is probably relevant in some way for the
> > split commit messages. It is helpful for the user to have access to
> > the pre-split commit message, so we provide the original commit
> > message. This is more helpful than completely dropping the original
> > commit message during a split.
> 
> I'm a bit confused here because I -already- see such behavior without 
> your patch.
> 
> https://www.mercurial-scm.org/repo/evolve/file/9bcb24c3ba8d2b5a7082ae61ac2193e867234822/hgext/evolve.py#l2788
> 
> However that aspect seems to be untested, it would be great to add a test.

Huh, I think I wrote this patch when I was on an old head, then
rebased, and didn't notice that the new base already had the
functionality.

I still prefer my wording, though. Can I resend that part?
Pierre-Yves David - March 23, 2016, 2:11 a.m.
On 03/22/2016 07:08 PM, Jordi Gutiérrez Hermoso wrote:
> On Tue, 2016-03-22 at 12:00 -0700, Pierre-Yves David wrote:
>>
>> On 03/20/2016 03:18 PM, Jordi Gutiérrez Hermoso wrote:
>>> # HG changeset patch
>>> # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
>>> # Date 1458511862 14400
>>> #      Sun Mar 20 18:11:02 2016 -0400
>>> # Node ID f3c32a01d13f8bf64d29a758c6deb6dc8ee90466
>>> # Parent  9bcb24c3ba8d2b5a7082ae61ac2193e867234822
>>> split: reuse the pre-split commit message for the split ones
>>>
>>> The original commit message is probably relevant in some way for the
>>> split commit messages. It is helpful for the user to have access to
>>> the pre-split commit message, so we provide the original commit
>>> message. This is more helpful than completely dropping the original
>>> commit message during a split.
>>
>> I'm a bit confused here because I -already- see such behavior without
>> your patch.
>>
>> https://www.mercurial-scm.org/repo/evolve/file/9bcb24c3ba8d2b5a7082ae61ac2193e867234822/hgext/evolve.py#l2788
>>
>> However that aspect seems to be untested, it would be great to add a test.
>
> Huh, I think I wrote this patch when I was on an old head, then
> rebased, and didn't notice that the new base already had the
> functionality.
>
> I still prefer my wording, though. Can I resend that part?

Yep, submit your rewording to the crowd and we'll see what they think of it.

Cheers,

Patch

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -2766,6 +2766,16 @@  def cmdsplit(ui, repo, *revs, **opts):
         r = ctx.rev()
         disallowunstable = not obsolete.isenabled(repo,
                                                   obsolete.allowunstableopt)
+
+        # We'll re-use the same commit message for all split commits,
+        # as it's a reasonable starting point for writing the commit
+        # messages for each chunk.
+        opts['message'] = (
+            "HG: This is the original pre-split commit message. "
+            "Edit it as appropriate.\n\n%s"
+        ) % ctx.description()
+        opts['edit'] = True
+
         if disallowunstable:
             # XXX We should check head revs
             if repo.revs("(%d::) - %d", rev, rev):