Mercurial undo command

Bryan O'Sullivan bos at serpentine.com
Wed May 10 11:35:53 CDT 2006


On Wed, 2006-05-10 at 12:23 -0400, Sébastien Pierre wrote:

> I know that it may be complicated to implement, but simply consider  
> this question : wouldn't it be nice to be able to undo whatever  
> change you did to the repository or working directory ?

I don't think so.  We already let you undo operations on the repository,
and that's fairly safe, because we control the repository.  But the
working directory is completely under the user's control, and can be
arbitrarily messed up by a user's actions.  In general, we can't
reliably detect or fix whatever they've done wrong, because we're not
the filesystem; they need to do it themselves.

Even trying to specify what should happen in an ideal world is hard.
What if someone does a "hg rename" of a file to a new name, then fills
the renamed file with junk, then decides they want to "undo it"?  What
should get undone - the filling with junk, or the rename?  If the rename
is to be undone, should the junk be copied back to the old name of the
file, or left alone?  If it should be copied back, what if the user
doesn't notice and commits the junk?

Anything that purports to automatically undo a user error has to be
predictable and always get it right, otherwise it's worse than having
nothing at all.

	<b

-- 
Bryan O'Sullivan <bos at serpentine.com>



More information about the Mercurial mailing list