Mercurial: how to recover from an interrupted "qpop -a"?

mercurial, mercurial-queue

Solution

It sounds like your dirstate was corrupted by the failed operation. A similar issue was reported to the `hg` mailing list a long time ago (link). You should review this blog post by Andreas Wuest that goes over a recovery procedure.

It basically boils down to this:

$ > .hg/patches/status          # force mq to think no patches are applied
$ hg debugrebuildstate -r tip   # rebuild your working copy

This does not destroy your patch queue, nor does it lose any working copy changes that were not part of a patch. However you need to carefully inspect (and maybe fix) file versions to get back to a clean working copy.

Problem

I've imported a couple of revisions into the queue and tried to pop them all. Unfortunately, according to some other Mercurial client accessing the same repository, `hg qpop -a` didn't complete successfully: ``` > hg qpop -a popping 115.diff popping 114.diff popping 113.diff popping 112.diff popping 111.diff abort: The process cannot access the file because it is being used by another process C:\Program Files (x86)\Mercurial\library.zip\mercurial\dispatch.py:217: DeprecationWarning: use lock.release instead of del lock ``` Now I'm not able anymore to push the patches back. Mercurial always complains about an "unknown node": ``` > hg qpush -a mq status file refers to unknown node b6fb614866f1 abort: working directory revision is not qtip ``` What does this mean and how can this problem be resolved?

Original source