Question: Revert command
Matt Mackall
mpm at selenic.com
Sat Jul 2 03:14:48 UTC 2005
On Fri, Jul 01, 2005 at 09:26:35PM -0400, Mark wrote:
> Given a set of changes (as displayed by hg diff) how do I revert those
> changes. Thow them away. Can I do it on just single files? I realize
> if I need to throw away an entire repository I 'could' just do a new
> clone but what about when I just want to dump a small set of the
> changes that I have made.
That depends on whether there are any witnesses.
If anyone's seen your changes, the only way to undo them is to commit
a change that does the opposite:
hg diff -r good | patch -p1 -R
This should probably become a nice command like "hg revert [files]".
If no one's seen you do it, then you can theoretically erase the
history. The plan is to have an option for pull and clone to 'pull to
revision <x>' where x was the last good commit.
I'm not in a big hurry to implement this. Disposable private branches
and undo already give you much more control over your past mistakes
than a normal SCM and mistakes with witnesses will still happen so
people should get comfortable with them.
And arguably, burying your mistakes is a mistake too as it loses
valuable history of how not to do something.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial
mailing list