changeset 16825:b6ef1395d77f

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.
author Matt Mackall <mpm@selenic.com>
date Fri, 01 Jun 2012 15:13:05 -0500
parents f3b8c82a559c
children 8abee656e14c
files mercurial/revset.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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: