[PATCH RFC] commit: add --amend option to amend the parent changeset
Jason Harris
jason at jasonfharris.com
Mon Feb 20 18:07:03 UTC 2012
On Feb 20, 2012, at 5:29 PM, Antoine Pitrou wrote:
> On Mon, 20 Feb 2012 17:19:44 +0100
> Jason Harris <jason at jasonfharris.com> wrote:
>>
>> To the user, the amend part is really associated with commit. It's doing the
>> same thing.
>
> To me as an user, it doesn't. Modifying is not the same as creating.
> Actually, most software has "New document" and "Open document" as
> separate (GUI) commands.
Well... it's not creating, it's really saving. And in a GUI save is save, no
matter if you have an untitled document which has never been saved before or you
have a document which exists and you are just saving the changes. So the normal
GUI document model has commit and amend just being save (if you want to do a GUI
comparison...)
>> 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.
>
> I mostly use commit without options. I also often use log without
> options (I have the pager extension enabled, so I don't have to
> specify -l).
>
>> 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.
>
> Do you plan to introduce a short-hand for "--amend", at least?
If you want a short hand just create an alias. They are really trivial. You can even
create your own command amend like so
[alias]
amend = commit --amend
>> Besides, using new commands, instead of options would lead to combinatorial
>> explosion.
>
> Combinatorial explosion of what?
combinatorial explosion of commands. Taken to the extreme you would have
pull = pull
pull -u = pullandupdate
pull -f = pullandforce
pull -u -f = pullandforceandupdate
pull --rebase = pullandrebase
pull --rebase -f = pullandrebaseandforce
pull --insecure = pullandinsecure
pull --insecure -f = pullandinsecureandforce
pull --insecure -f -u = pullandinsecureandforceandupdate
etc. etc.
From Mathematica:
In[1]:= Length @
Subsets[{update, force, rev, bookmark, branch, ssh, remotecmd,
insecure, mq, rebase, tool}]
Out[1]= 2048
So to get rid of the options for pull you would need the equivalent of 2048
different commands. Ie the power set in the number of options. etc, etc. Thus
replacing options with separate commands is in general not a good idea. Of
course the art of interface design is knowing where to draw that line of what to
group into a command and win to separate things out. And that decision should be
made in terms of the user perspective, and definitely not how the internals work.
Cheers,
Jason
More information about the Mercurial-devel
mailing list