You speak without cloning, and I get to that, but first let me point out that this is:
cd .. hg clone -r -2 yourrepo yournewrepo
is an instant action that gives you a new clone, locally, without the last two commits in your old repo. Since it is a local clone that uses hard links (even on Windows), so the repository does not take up additional disk space.
This is a classic Mercurial solution. Mercurial was built with the idea of ββan unchanging story. If there is something in the story, you regret doing the opposite (which is what the backout does), so the story shows the error and its correction - like the journal of the journal of scientists. If you cannot / could not remain in history, you would make a clone that excludes it, as I showed above.
Not everyone can be so ... hardcore ... about their story, so many extensions have appeared that will change the story, but they must be specifically included. In your case, the rebase extension that you already installed (it now ships with Mercurial) will do exactly what you want. You just need to include it in your ~/.hgrc and then repeat D on A. If you really want C to leave, the strip command from the mq extension will do this. It also comes with Mercurial.
Ry4an brase
source share