13

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?

mstrap
  • 16,808
  • 10
  • 56
  • 86

1 Answers1

22

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.

Tim Henigan
  • 60,452
  • 11
  • 85
  • 78
  • Thanks. I had read Andreas Wuest's article, but didn't understand the Unix command > .hg/patches/status :) I did now, thanks to your answer. – mstrap Jun 08 '12 at 14:03
  • 2
    For anyone using multiple patch queues (hg qq), you'll have to clear the status file on whichever patch directory is corrupt, e.g., "> .hg/patches-default/status" – Joshua Goldberg Jul 03 '13 at 15:51