I used hg shelve
in a repository, where I had some unfinished changes because I needed to switch to a different head and perform unrelated changes.
Once my work on the other head was committed, I switched back to the head on which I had originally used hg shelve
and ran a hg unshelve
command. This was the result:
$ hg unshelve
unshelving change 'default'
adding changesets
adding manifests
adding file changes
added 1 changesets with 4 changes to 4 files (+1 heads)
abort: uncommitted changes
$ hg diff
warning: ignoring unknown working parent 893e15ecb5b4!
$
I did run hg head
before and after the unshelve
command and saw identical outputs. The commit 893e15ecb5b4
never existed, I have no clue where Mercurial got it from.
In case it is of any relevance, I am running Mercurial version 2.8.2 on Ubuntu 14.04.
How can I get my repository back in a working state, and how can I get my shelved changes back?
The following steps solved the problems for me:
hg debugsetparents
to replace the corrupted parent revision number 893e15ecb5b4
with the correct one I had updated to before using unshelve
hg manifest | tr '\n' '\0' | xargs -0 touch
to get it to notice any local changes again.patch -p1 < .hg/shelved/default.patch
, which in my case did exactly what hg unshelve
should have done for me in the first place.