# HG changeset patch # User Matt Mackall # Date 1298936500 21600 # Node ID 0396ca8015becbb55c2854048e92f4a25992a26a # Parent 375ba42f3cda34a540a4a46f4c0a63893c3c2907 mq: fix qpush recursion in _findtags when status file is wrong (issue2664) test from timeless to guard against regressing this diff -r 375ba42f3cda -r 0396ca8015be hgext/mq.py --- a/hgext/mq.py Fri Feb 11 13:10:39 2011 +0100 +++ b/hgext/mq.py Mon Feb 28 17:41:40 2011 -0600 @@ -2957,7 +2957,9 @@ mqtags = [(patch.node, patch.name) for patch in q.applied] - if mqtags[-1][0] not in self: + try: + r = self.changelog.rev(mqtags[-1][0]) + except error.RepoLookupError: self.ui.warn(_('mq status file refers to unknown node %s\n') % short(mqtags[-1][0])) return result @@ -2982,12 +2984,13 @@ cl = self.changelog qbasenode = q.applied[0].node - if qbasenode not in self: + try: + qbase = cl.rev(qbasenode) + except error.LookupError: self.ui.warn(_('mq status file refers to unknown node %s\n') % short(qbasenode)) return super(mqrepo, self)._branchtags(partial, lrev) - qbase = cl.rev(qbasenode) start = lrev + 1 if start < qbase: # update the cache (excluding the patches) and save it diff -r 375ba42f3cda -r 0396ca8015be tests/test-mq-qpush-fail.t --- a/tests/test-mq-qpush-fail.t Fri Feb 11 13:10:39 2011 +0100 +++ b/tests/test-mq-qpush-fail.t Mon Feb 28 17:41:40 2011 -0600 @@ -51,6 +51,22 @@ summary: add foo +test corrupt status file + $ hg qpush + applying patch1 + now at: patch1 + $ cp .hg/patches/status .hg/patches/status.orig + $ hg qpop + popping patch1 + patch queue now empty + $ cp .hg/patches/status.orig .hg/patches/status + $ hg qpush + mq status file refers to unknown node * (glob) + abort: working directory revision is not qtip + [255] + $ rm .hg/patches/status .hg/patches/status.orig + + bar should be gone; other unknown/ignored files should still be around $ hg status -A