Mercurial undo command

Sébastien Pierre sebastien at xprima.com
Mon May 8 12:35:40 CDT 2006


Le lundi 08 mai 2006 à 12:26 -0400, Colin McMillen a écrit :
> > The unbundle command can also be rolled back, as can import, as can an
> > incoming push.  Having a proliferation of command names with "un-"
> > prefixes is not helpful.
> 
> If the problem is merely with the plethora of command names that would
> result, I suggest removing "undo" altogether and adding an --undo
> option to commands that support it:
> 
> hg commit --undo
> hg unbundle --undo

There is something that bugs me about the "--undo/--rollback" solution :
what happens when the user has made a sequence of commands, and issues
an --undo/rollback for one of these commands ?

> hg commit
> hg ...
> hg pull
> hg ...

and does

> hg commit --undo
> hg pull -undo


Undo or rollback should, IMHO, simply undo/rollback the most recent
transaction. If the latest transaction cannot be rolled back, then an
error could be raised (or maybe an advice on what to do could be given).

In this case, the "undo" command could be kept, and particular cases
could be taken into account by advicing the user on what to do
(manually) to return to a previous state.

I really do think that an "undo" can be attractive to people considering
Mercurial, and do think it helps newbies (or simply people who want to
experiment), because it grants the user the "right to make mistakes".


 -- Sébastien









More information about the Mercurial mailing list