Why backout, not revert?

Masklinn masklinn at masklinn.net
Tue Mar 25 05:46:04 CDT 2008

On 25 Mar 2008, at 10:37 , Marcin Kasperski wrote:

> Are there any noticeable advantages of using backout instead of  
> revert?
> (by using revert I mean
>     hg revert -r BeforeIStartedThisBadIdea
>     hg commit -m "Giving up the flawed concept"
> )

They're completely different:

* hg revert cancels changes in the local copy, it does not touch the  
repository (basically, it gets the file(s) back to repository state)
* hg backout applies changes in reverse, its goal is to revert *an  
already commited changeset*. And it doesn't remove it, it creates a  
changeset that does the inverse. So instead of removing changes, it  
just applies the invert of the existing changes.
* finally, hg rollback "unapplies" the current tip (but doesn't revert  
it) which allows you to recraft your patch and re-commit it later.

More information about the Mercurial mailing list