John Arbash Meinel
john at arbash-meinel.com
Tue Dec 12 00:00:17 GMT 2006
Nicholas Allen wrote:
> I think it makes sense to have an undo command that can revert the
> changes made in given revision (or revision range) for a file or the
> entire branch. I know this is possible with the merge command but that
> is not very intuitive or obvious and I don't think it can work on
> individual files but only the whole branch. I guess you could also do it
> with the diff command and then pipe that through the patch command but
> that is also a little cumbersome. It seems that this is a reasonably
> high level operation but it has no simple command to implement it.
> Wouldn't it make sense to have a command to do this?
I would be okay having a command that makes it easier to remove the
changes from a given revision. I'm not sure what it should be called,
but it certainly shouldn't be called 'undo'. Undo is a very heavily
overloaded word, and if you have 'undo' people will expect a 'redo'.
Arch had an 'undo' command, which was basically what our 'revert' does,
only it generated Arch's equivalent of a bundle, so you could "undo"
your uncommitted changes and "redo" them either in place, or in another
branch. What happened there, though, is that people started thinking
that 'undo' should be capable of undoing the last action. So if they did
'bzr commit' then 'bzr undo' should undo the commit. Or 'undo' after a
merge should revert the merge. Or the push, or etc, etc.
So I would save 'undo' for something that actually tracks the commands
that have been done, and is able to act like people expect.
To me, the next best name is 'revert', which already does that a little
bit, but it doesn't revert the change, it reverts back to the revision.
So I can see that it doesn't quite fit what you want.
Merge with two revisions does do what you want, but I can understand
that it is a little clumsy (it is also more powerful, since you can
remove several changes at once).
I'm also a little concerned that users would expect a command like this
to mark something in the meta data about what patch was reverted, such
that they could get a list (like 'bzr missing' would show the reverted
patch). It is akin to cherry-picking, only in reverse.
I don't have a good name for it yet, since my favorite name is already
taken. hg also uses 'revert', git uses 'reset' to do something similar
to our 'revert'. Git also has the command 'revert' which does what you
are asking, at least sort of. It commits a change which undoes the
change done by another commit.
So can we come up with a good synonym for revert? I haven't found
anything very good with a couple quick searches.
More information about the bazaar