[PATCH RFC] commit: add --reuse-message for keeping the old commit message during amend

Augie Fackler raf at durin42.com
Tue Feb 19 19:35:13 CST 2013


On Feb 14, 2013, at 5:23 AM, Pierre-Yves David <pierre-yves.david at logilab.fr> wrote:

> On Wed, Feb 13, 2013 at 07:42:44PM +0000, Durham Goode wrote:
>> On 2/12/13 8:56 PM, "Matt Mackall" <mpm at selenic.com> wrote:
>>> 
>>> I'm now inclined to think that 'hg commit --amend' will eventually be
>>> replaced by 'hg amend', which will have a different default. Then we'll
>>> deprecate --amend on commit.
>>> 
>>> So I think we should leave this alone. But I don't think we've got quite
>>> enough experience here to add the new amend command yet.
> 
> In evolve, I'll probably drop the internal "hg amend" code in favor of using "hg commit
> --amend" with an altered editor.

Hm. I think it's bad practice for extensions to alter the behavior of off the shelf commands with off the shelf flags - I've done that in the past and always regretted it.

> 
>> 
>> 
>> If anyone feels strongly about getting the extra commit flag in, speak up.
>> For Facebook's purposes we will just add an amend alias for our users
>> that does 'hg --config ui.editor=true commit --amend' while we wait for
>> the real 'hg amend'.
> 
> Note that you have to fix --config in alias first :-)
> 
>> As for having amend experience, as I've started using evolve more I've
>> found I use an amend flows in three ways:
>> 
>> 1. (most common) Amending the code in the current commit
>> 2. Amending the code in a commit further down.
>> 3. (least common) Amending the commit description.
> 
> My most common usage are #1 and #3. I usually the "." commit as a "staging area"
> slowly adding content and writing the commit message at the end.
> 
> The #2 operation is multi step
> 
> a) rebase your change on target commit (as hg update with dirty wc does)
> b) amend
> c) hg evolve --all descendant
> 
> It's probably something that we'll want but that requires first class support for multi step operation. Otherwise user will get terribly confused.
> 
>> So my ideal "hg amend" would do #1 by default, #2 with "hg amend --to
>> 'tip~2'", and #3 with "hg amend -e".  #2 is the only crazy one, but I've
>> been using a script that does it in one step and it makes editing chains
>> of commits much much easier.
> 
> -- 
> Pierre-Yves David
> 
> http://www.logilab.fr/
> 



More information about the Mercurial-devel mailing list