Mercurial > public > mercurial-scm > hg-stable
diff hgext/mq.py @ 5979:b4858eb4b58f
mqrepo: don't abort if the status file has an unknown node
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Sun, 03 Feb 2008 21:03:46 -0200 |
parents | 61c230f81068 |
children | dcda0c90125c |
line wrap: on
line diff
--- a/hgext/mq.py Sun Feb 03 21:03:46 2008 -0200 +++ b/hgext/mq.py Sun Feb 03 21:03:46 2008 -0200 @@ -2096,6 +2096,12 @@ return tagscache mqtags = [(revlog.bin(patch.rev), patch.name) for patch in q.applied] + + if mqtags[-1][0] not in self.changelog.nodemap: + self.ui.warn('mq status file refers to unknown node %s\n' + % revlog.short(mqtags[-1][0])) + return tagscache + mqtags.append((mqtags[-1][0], 'qtip')) mqtags.append((mqtags[0][0], 'qbase')) mqtags.append((self.changelog.parents(mqtags[0][0])[0], 'qparent')) @@ -2112,11 +2118,17 @@ if not q.applied: return super(mqrepo, self)._branchtags() + cl = self.changelog + qbasenode = revlog.bin(q.applied[0].rev) + if qbasenode not in cl.nodemap: + self.ui.warn('mq status file refers to unknown node %s\n' + % revlog.short(qbasenode)) + return super(mqrepo, self)._branchtags() + self.branchcache = {} # avoid recursion in changectx - cl = self.changelog partial, last, lrev = self._readbranchcache() - qbase = cl.rev(revlog.bin(q.applied[0].rev)) + qbase = cl.rev(qbasenode) start = lrev + 1 if start < qbase: # update the cache (excluding the patches) and save it