[PATCH 2 of 4] revset: rename tagged() to tag() and allow it to take an optional tag name
Augie Fackler
durin42 at gmail.com
Mon Oct 11 19:27:42 CDT 2010
# HG changeset patch
# User Augie Fackler <durin42 at gmail.com>
# Date 1286732496 18000
# Node ID b423b1ba1d43c51543859a8a2d1e6e7fd0ac6857
# Parent ddf90149aa999ebfbc4f6a00ce63da2c65c93579
revset: rename tagged() to tag() and allow it to take an optional tag name
diff --git a/mercurial/help/revsets.txt b/mercurial/help/revsets.txt
--- a/mercurial/help/revsets.txt
+++ b/mercurial/help/revsets.txt
@@ -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 --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -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 --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -287,6 +287,12 @@
4
$ log 'tagged()'
6
+ $ log 'tag()'
+ 6
+ $ log 'tag(1.0)'
+ 6
+ $ log 'tag(tip)'
+ 9
$ log 'user(bob)'
2
More information about the Mercurial-devel
mailing list