Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
5978:7939c71f3132 | 5979:b4858eb4b58f |
---|---|
2094 q = self.mq | 2094 q = self.mq |
2095 if not q.applied: | 2095 if not q.applied: |
2096 return tagscache | 2096 return tagscache |
2097 | 2097 |
2098 mqtags = [(revlog.bin(patch.rev), patch.name) for patch in q.applied] | 2098 mqtags = [(revlog.bin(patch.rev), patch.name) for patch in q.applied] |
2099 | |
2100 if mqtags[-1][0] not in self.changelog.nodemap: | |
2101 self.ui.warn('mq status file refers to unknown node %s\n' | |
2102 % revlog.short(mqtags[-1][0])) | |
2103 return tagscache | |
2104 | |
2099 mqtags.append((mqtags[-1][0], 'qtip')) | 2105 mqtags.append((mqtags[-1][0], 'qtip')) |
2100 mqtags.append((mqtags[0][0], 'qbase')) | 2106 mqtags.append((mqtags[0][0], 'qbase')) |
2101 mqtags.append((self.changelog.parents(mqtags[0][0])[0], 'qparent')) | 2107 mqtags.append((self.changelog.parents(mqtags[0][0])[0], 'qparent')) |
2102 for patch in mqtags: | 2108 for patch in mqtags: |
2103 if patch[1] in tagscache: | 2109 if patch[1] in tagscache: |
2110 def _branchtags(self): | 2116 def _branchtags(self): |
2111 q = self.mq | 2117 q = self.mq |
2112 if not q.applied: | 2118 if not q.applied: |
2113 return super(mqrepo, self)._branchtags() | 2119 return super(mqrepo, self)._branchtags() |
2114 | 2120 |
2121 cl = self.changelog | |
2122 qbasenode = revlog.bin(q.applied[0].rev) | |
2123 if qbasenode not in cl.nodemap: | |
2124 self.ui.warn('mq status file refers to unknown node %s\n' | |
2125 % revlog.short(qbasenode)) | |
2126 return super(mqrepo, self)._branchtags() | |
2127 | |
2115 self.branchcache = {} # avoid recursion in changectx | 2128 self.branchcache = {} # avoid recursion in changectx |
2116 cl = self.changelog | |
2117 partial, last, lrev = self._readbranchcache() | 2129 partial, last, lrev = self._readbranchcache() |
2118 | 2130 |
2119 qbase = cl.rev(revlog.bin(q.applied[0].rev)) | 2131 qbase = cl.rev(qbasenode) |
2120 start = lrev + 1 | 2132 start = lrev + 1 |
2121 if start < qbase: | 2133 if start < qbase: |
2122 # update the cache (excluding the patches) and save it | 2134 # update the cache (excluding the patches) and save it |
2123 self._updatebranchcache(partial, lrev+1, qbase) | 2135 self._updatebranchcache(partial, lrev+1, qbase) |
2124 self._writebranchcache(partial, cl.node(qbase-1), qbase-1) | 2136 self._writebranchcache(partial, cl.node(qbase-1), qbase-1) |