Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 8852:a81652fcaf6b
tags: reverse and simplify head-walking
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 18 Jun 2009 20:50:35 -0500 |
parents | 52cf210d0046 |
children | e28b7939d430 |
comparison
equal
deleted
inserted
replaced
8851:52cf210d0046 | 8852:a81652fcaf6b |
---|---|
289 ah.extend([n for n in bh if n not in ah]) | 289 ah.extend([n for n in bh if n not in ah]) |
290 globaltags[k] = an, ah | 290 globaltags[k] = an, ah |
291 tagtypes[k] = tagtype | 291 tagtypes[k] = tagtype |
292 | 292 |
293 def tagnodes(): | 293 def tagnodes(): |
294 last = {} | 294 seen = set() |
295 ret = [] | 295 ret = [] |
296 for node in reversed(self.heads()): | 296 for node in self.heads(): |
297 c = self[node] | 297 c = self[node] |
298 try: | 298 try: |
299 fnode = c.filenode('.hgtags') | 299 fnode = c.filenode('.hgtags') |
300 except error.LookupError: | 300 except error.LookupError: |
301 continue | 301 continue |
302 ret.append((node, fnode)) | 302 if fnode not in seen: |
303 if fnode in last: | 303 ret.append((node, fnode)) |
304 ret[last[fnode]] = None | 304 seen.add(fnode) |
305 last[fnode] = len(ret) - 1 | 305 return reversed(ret) |
306 return [item for item in ret if item] | |
307 | 306 |
308 # read the tags file from each head, ending with the tip | 307 # read the tags file from each head, ending with the tip |
309 f = None | 308 f = None |
310 for node, fnode in tagnodes(): | 309 for node, fnode in tagnodes(): |
311 f = (f and f.filectx(fnode) or | 310 f = (f and f.filectx(fnode) or |