You can use mq patches to edit your recent history. The following command would do the trick:
hg qinit # initialises a queue
hg qimport -r2: TIP # moves revisions from 2 onwards into patch management
hg qpop -a # unapplies patches, leaving your actual checkout at r1
hg qrm 2.diff # deletes the r2 patch (forever)
hg qpush -a # applies all remaining patches again (ie the r3 patch)
hg qfinish -a # moves applied patches back into official repository history
Such a thing is great for fixing an error in your local repository, but since you are changing the history, make sure that you did not click on someone else (or they did not pull from you) the original version before you corrected it.
If I understood correctly, hg backout instead make a new patch that undoes the previous change, thereby saving the changes in your history. This is a safer option, but less enjoyable if you often make local mistakes (like me).
source share