# HG changeset patch # User Augie Fackler # Date 1286732496 18000 # Node ID 33820dccbea4d0cf90dd756b92aca1f5de815f38 # Parent f5178fbcd197f82a77e5df28f7dfc4c44450db87 revset: rename tagged() to tag() and allow it to take an optional tag name diff -r f5178fbcd197 -r 33820dccbea4 mercurial/help/revsets.txt --- a/mercurial/help/revsets.txt Sun Oct 10 12:40:25 2010 -0500 +++ b/mercurial/help/revsets.txt Sun Oct 10 12:41:36 2010 -0500 @@ -151,8 +151,8 @@ - ``user`` for user name (``author`` can be used as an alias), - ``date`` for the commit date -``tagged()`` - Changeset is tagged. +``tag(name)`` + The specified tag by name, or all tagged revisions if no name is given. ``user(string)`` User name is string. diff -r f5178fbcd197 -r 33820dccbea4 mercurial/revset.py --- a/mercurial/revset.py Sun Oct 10 12:40:25 2010 -0500 +++ b/mercurial/revset.py Sun Oct 10 12:41:36 2010 -0500 @@ -467,10 +467,15 @@ o = set([cl.rev(r) for r in repo.changelog.nodesbetween(o, revs)[0]]) return [r for r in subset if r in o] -def tagged(repo, subset, x): - getargs(x, 0, 0, _("tagged takes no arguments")) +def tag(repo, subset, x): + args = getargs(x, 0, 1, _("tag takes one or no arguments")) cl = repo.changelog - s = set([cl.rev(n) for t, n in repo.tagslist() if t != 'tip']) + if args: + tn = getstring(args[0], + _('the argument to tag must be a string')) + s = set([cl.rev(n) for t, n in repo.tagslist() if t == tn]) + else: + s = set([cl.rev(n) for t, n in repo.tagslist() if t != 'tip']) return [r for r in subset if r in s] symbols = { @@ -505,7 +510,8 @@ "reverse": reverse, "roots": roots, "sort": sort, - "tagged": tagged, + "tag": tag, + "tagged": tag, "user": author, } diff -r f5178fbcd197 -r 33820dccbea4 tests/test-revset.t --- a/tests/test-revset.t Sun Oct 10 12:40:25 2010 -0500 +++ b/tests/test-revset.t Sun Oct 10 12:41:36 2010 -0500 @@ -287,6 +287,12 @@ 4 $ log 'tagged()' 6 + $ log 'tag()' + 6 + $ log 'tag(1.0)' + 6 + $ log 'tag(tip)' + 9 $ log 'user(bob)' 2