##// END OF EJS Templates
revset: add pattern matching to 'tag' revset expression...
Simon King -
r16820:20f55613 default
parent child Browse files
Show More
@@ -1167,12 +1167,18 def tag(repo, subset, x):
1167 1167 args = getargs(x, 0, 1, _("tag takes one or no arguments"))
1168 1168 cl = repo.changelog
1169 1169 if args:
1170 tn = getstring(args[0],
1170 pattern = getstring(args[0],
1171 1171 # i18n: "tag" is a keyword
1172 1172 _('the argument to tag must be a string'))
1173 if not repo.tags().get(tn, None):
1174 raise util.Abort(_("tag '%s' does not exist") % tn)
1175 s = set([cl.rev(n) for t, n in repo.tagslist() if t == tn])
1173 kind, pattern, matcher = _stringmatcher(pattern)
1174 if kind == 'literal':
1175 if not repo.tags().get(pattern, None):
1176 raise util.Abort(_("tag '%s' does not exist") % pattern)
1177 s = set([cl.rev(n) for t, n in repo.tagslist() if t == pattern])
1178 else:
1179 s = set([cl.rev(n) for t, n in repo.tagslist() if matcher(t)])
1180 if not s:
1181 raise util.Abort(_("no tags exist that match '%s'") % pattern)
1176 1182 else:
1177 1183 s = set([cl.rev(n) for t, n in repo.tagslist() if t != 'tip'])
1178 1184 return [r for r in subset if r in s]
@@ -369,6 +369,22 quoting needed
369 369 6
370 370 $ log 'tag(tip)'
371 371 9
372
373 we can use patterns when searching for tags
374
375 $ log 'tag("1..*")'
376 abort: tag '1..*' does not exist
377 [255]
378 $ log 'tag("re:1..*")'
379 6
380 $ log 'tag("re:[0-9].[0-9]")'
381 6
382 $ log 'tag("literal:1.0")'
383 6
384 $ log 'tag("re:0..*")'
385 abort: no tags exist that match '0..*'
386 [255]
387
372 388 $ log 'tag(unknown)'
373 389 abort: tag 'unknown' does not exist
374 390 [255]
General Comments 0
You need to be logged in to leave comments. Login now