Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revset.py @ 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 | cafd8a8fb713 |
comparison
equal
deleted
inserted
replaced
16824:f3b8c82a559c | 16825:b6ef1395d77f |
---|---|
1212 pattern = getstring(args[0], | 1212 pattern = getstring(args[0], |
1213 # i18n: "tag" is a keyword | 1213 # i18n: "tag" is a keyword |
1214 _('the argument to tag must be a string')) | 1214 _('the argument to tag must be a string')) |
1215 kind, pattern, matcher = _stringmatcher(pattern) | 1215 kind, pattern, matcher = _stringmatcher(pattern) |
1216 if kind == 'literal': | 1216 if kind == 'literal': |
1217 if not repo.tags().get(pattern, None): | 1217 # avoid resolving all tags |
1218 tn = repo._tagscache.tags.get(pattern, None) | |
1219 if tn is None: | |
1218 raise util.Abort(_("tag '%s' does not exist") % pattern) | 1220 raise util.Abort(_("tag '%s' does not exist") % pattern) |
1219 s = set([cl.rev(n) for t, n in repo.tagslist() if t == pattern]) | 1221 s = set([repo[tn].rev()]) |
1220 else: | 1222 else: |
1221 s = set([cl.rev(n) for t, n in repo.tagslist() if matcher(t)]) | 1223 s = set([cl.rev(n) for t, n in repo.tagslist() if matcher(t)]) |
1222 if not s: | 1224 if not s: |
1223 raise util.Abort(_("no tags exist that match '%s'") % pattern) | 1225 raise util.Abort(_("no tags exist that match '%s'") % pattern) |
1224 else: | 1226 else: |