revset: avoid validating all tag nodes for tag(x)
This generally causes the entire node->rev table to get built when
we're only interested in one node.
--- a/mercurial/revset.py Wed May 30 23:14:04 2012 +0100
+++ b/mercurial/revset.py Fri Jun 01 15:13:05 2012 -0500
@@ -1214,9 +1214,11 @@
_('the argument to tag must be a string'))
kind, pattern, matcher = _stringmatcher(pattern)
if kind == 'literal':
- if not repo.tags().get(pattern, None):
+ # avoid resolving all tags
+ tn = repo._tagscache.tags.get(pattern, None)
+ if tn is None:
raise util.Abort(_("tag '%s' does not exist") % pattern)
- s = set([cl.rev(n) for t, n in repo.tagslist() if t == pattern])
+ s = set([repo[tn].rev()])
else:
s = set([cl.rev(n) for t, n in repo.tagslist() if matcher(t)])
if not s: