Mercurial > hg-stable
changeset 8850:9db1c8e1cf17
tags: fold in _hgtagsnodes
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 18 Jun 2009 20:49:50 -0500 |
parents | 80cc4b1a62d0 |
children | 52cf210d0046 |
files | mercurial/localrepo.py |
diffstat | 1 files changed, 17 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Tue May 19 16:49:54 2009 +0900 +++ b/mercurial/localrepo.py Thu Jun 18 20:49:50 2009 -0500 @@ -290,9 +290,25 @@ globaltags[k] = an, ah tagtypes[k] = tagtype + def tagnodes(): + last = {} + ret = [] + for node in reversed(self.heads()): + c = self[node] + rev = c.rev() + try: + fnode = c.filenode('.hgtags') + except error.LookupError: + continue + ret.append((rev, node, fnode)) + if fnode in last: + ret[last[fnode]] = None + last[fnode] = len(ret) - 1 + return [item for item in ret if item] + # read the tags file from each head, ending with the tip f = None - for rev, node, fnode in self._hgtagsnodes(): + for rev, node, fnode in tagnodes(): f = (f and f.filectx(fnode) or self.filectx('.hgtags', fileid=fnode)) readtags(f.data().splitlines(), f, "global") @@ -328,22 +344,6 @@ return self._tagstypecache.get(tagname) - def _hgtagsnodes(self): - last = {} - ret = [] - for node in reversed(self.heads()): - c = self[node] - rev = c.rev() - try: - fnode = c.filenode('.hgtags') - except error.LookupError: - continue - ret.append((rev, node, fnode)) - if fnode in last: - ret[last[fnode]] = None - last[fnode] = len(ret) - 1 - return [item for item in ret if item] - def tagslist(self): '''return a list of tags ordered by revision''' l = []