equal
deleted
inserted
replaced
242 self.tagscache[key] = bin_n |
242 self.tagscache[key] = bin_n |
243 |
243 |
244 # read the tags file from each head, ending with the tip, |
244 # read the tags file from each head, ending with the tip, |
245 # and add each tag found to the map, with "newer" ones |
245 # and add each tag found to the map, with "newer" ones |
246 # taking precedence |
246 # taking precedence |
247 heads = self.heads() |
247 f = None |
248 heads.reverse() |
248 for rev, node, fnode in self._hgtagsnodes(): |
249 seen = {} |
249 f = (f and f.filectx(fnode) or |
250 for node in heads: |
250 self.filectx('.hgtags', fileid=fnode)) |
251 f = self.filectx('.hgtags', node) |
|
252 if not f or f.filerev() in seen: continue |
|
253 seen[f.filerev()] = 1 |
|
254 count = 0 |
251 count = 0 |
255 for l in f.data().splitlines(): |
252 for l in f.data().splitlines(): |
256 count += 1 |
253 count += 1 |
257 parsetag(l, _("%s, line %d") % (str(f), count)) |
254 parsetag(l, _("%s, line %d") % (str(f), count)) |
258 |
255 |
266 pass |
263 pass |
267 |
264 |
268 self.tagscache['tip'] = self.changelog.tip() |
265 self.tagscache['tip'] = self.changelog.tip() |
269 |
266 |
270 return self.tagscache |
267 return self.tagscache |
|
268 |
|
269 def _hgtagsnodes(self): |
|
270 heads = self.heads() |
|
271 heads.reverse() |
|
272 last = {} |
|
273 ret = [] |
|
274 for node in heads: |
|
275 c = self.changectx(node) |
|
276 rev = c.rev() |
|
277 try: |
|
278 fnode = c.filenode('.hgtags') |
|
279 except repo.LookupError: |
|
280 continue |
|
281 ret.append((rev, node, fnode)) |
|
282 if fnode in last: |
|
283 ret[last[fnode]] = None |
|
284 last[fnode] = len(ret) - 1 |
|
285 return [item for item in ret if item] |
271 |
286 |
272 def tagslist(self): |
287 def tagslist(self): |
273 '''return a list of tags ordered by revision''' |
288 '''return a list of tags ordered by revision''' |
274 l = [] |
289 l = [] |
275 for t, n in self.tags().items(): |
290 for t, n in self.tags().items(): |