[PATCH RFC] commit: add --amend option to amend the parent changeset

Jason Harris jason at jasonfharris.com
Mon Feb 20 10:19:44 CST 2012

On Feb 20, 2012, at 4:15 PM, Antoine Pitrou wrote:

> On Mon, 20 Feb 2012 15:31:40 +0100
> Arne Babenhauserheide <arne_bab at web.de> wrote:
>> Am Montag, 13. Februar 2012, 19:44:56 schrieb Pierre-Yves David:
>>> (3) As explained explained above, the amend concept **will** most certainly
>>> need additional option and flagging. If amend operation is available
>>> through a commit flag we have two solution to extend it:
>>>    A) Add flag to commit which are not related to what commit does.
>>>    B) Introduce a new command that finish the job.
>>>    Both solutions leads to inconsistent UI.
>> I do not think so.
>> This is equivalent to having hg pull -u. It cannot do everything that hg 
>> update can do, but it is extremely useful. Because in most cases I just need 
>> the simple use case.
>> If I want to update to non-tip, I use hg update.
>> If I want to do more than just amend the latest commit, I use hg amend.
> Isn't "hg amend" simpler to type than "hg commit --amend"?
> That goes counter to the idea of "hg amend" being the complex
> alternative.
> (as a user, I prefer separate commands to "--long-options", they are
> much easier to type. My 2 cents of course :-))
> Regards
> Antoine.

I have strongly advocated that amend should be implemented through a commit
option and I still feel this way.

To the user, the amend part is really associated with commit. It's doing the
same thing. Having to have a separate command for it is semantically wrong.
Besides, in almost all the commands one uses options, eg maybe the -A
(--addremove) to commit, or the -l (--limit) to log etc, etc. just take a look
at the test cases and all of the commands are littered with options. Option use
is a normal part of mercurial so the reasoning of "use a new command" instead of
an "option" just doesn't wash for me. As Arne said with that thinking, "hg pull
-u" should then be a new command, but it isn't and shouldn't be since it's really
a tweak to the pull operation. Likewise amending is a tweak to the commit
operation. It's a very simple quick switch. If the user wants more complicated
things there are plenty of other commands which will do the more complicated

Besides, using new commands, instead of options would lead to combinatorial


More information about the Mercurial-devel mailing list