Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot abort interrupted rebase

Tags:

mercurial

My repository is stuck in an apparent interrupted rebase: If I try a new commit, I get this message:

abort: rebase in progress
(use 'hg rebase --continue' or 'hg rebase --abort')

But hg rebase --abort fails with the message

abort: unknown revision '<hex id>'!

I even tried hg rebase --continue, but got the same error. hg verify thinks everything is ok. Is there a way I can get the repository unwedged, or do I have to throw it out and make a fresh clone? (Fortunately I was able to simply hg clone the broken repo and leave the problems behind. But I'd still like to know a better way out).

I have no idea how the repository got in this state; I might have done something that caused it months ago, I might not. I just got back to the repo and ran into this. (I do use rebase on occasion, and have never had problems). I looked for a backup bundle, but don't see one.

like image 292
alexis Avatar asked Dec 05 '25 03:12

alexis


1 Answers

hg debugcheckstate specifically examines "the correctness of the dirstate." I'm uncertain whether its checks are a subset of those performed by hg verify, but it couldn't hurt.

In situations similar to this one, you may be able to proceed with hg debugsetparents tip; hg up -C . (optionally replacing tip with a changeset ID) and then use hg strip to throw out any partially-rebased commits you don't want to keep. This basically overrides the usual hg update system and sets the working directory's parent to tip manually. The hg up -C then cleans up the working directory.

It is possible you will lose data by doing this; you should have a backup (e.g. on Bitbucket) from which you can hg pull any lost changesets. In a worst-case scenario, a new clone may be necessary.

like image 122
Kevin Avatar answered Dec 07 '25 22:12

Kevin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!