Reputation: 11334
I have a similar problem to what does 'skipping ancestor revision' mean when using 'graft'?
But this SO topic don't give solutions, only explanations.
In more details : Yesterday a co-worker commited an error and push it. Others co-workers and me added commits after this. In order to fix this error quickly I used hg backout to cancel this commit number 11511. But I don't want to loose this commit, so I created a new branch (from the backout commit) and I tried to graft the 11511 commit but Mercurial says :
skipping ancestor revision
I want getting the branch with the 11511 commit changes to fix the error. What are the solutions to do it ?
Upvotes: 2
Views: 1903
Reputation: 391664
OK, I misunderstood your question slightly.
The part below the line below is how to re-apply the bad changeset if you need to.
The important part here is that you're not losing anything. Backing out a changeset does not remove the original changeset from the history, instead it creates another changeset that is the opposite of the one you're backing out, in effect removing the changes the original changeset introduced.
So until you at some point decide to bring back those bad changes you don't have to do anything. At that point, when you want the bad changes back, you can do what I noted below. you do is update to the changeset immediately preceding the original bad changeset, then graft the bad changeset onto it, this will create a new head parallel to the original bad changeset that you have backed out.
This new head can later be merged back onto the head.
Another way to fix this would be to simply backout the backout changeset.
Upvotes: 0
Reputation: 8740
Mercurial gets confused because you are trying to graft a commit that already exists in the history (and doesn't realize that the backout reverted it).
There are a couple of possible solutions. One, use the -f
option to force hg graft
to proceed anyway:
hg graft -f -r 11511
Or, you can backout the backed out commit again on the branch that you created.
Upvotes: 7