reviewed() revset
authorGregory Szorc <gps@mozilla.com>
Fri, 08 Nov 2013 09:13:42 -0800
changeset 71 fb1e21435cdffb77c492547c82d22521363546a8
parent 70 cbc08bc115936d4ccfb766aa518782db83f855f7
child 72 35bb3c96d786f842f2776c17a37b4aacbc4c481a
push id51
push usergszorc@mozilla.com
push dateFri, 08 Nov 2013 17:13:45 +0000
reviewed() revset
__init__.py
--- a/__init__.py
+++ b/__init__.py
@@ -137,16 +137,19 @@ firstpushtree(TREE)
    Retrieve changesets that initially landed on the specified tree.
 
 reviewer(REVIEWER)
    Retrieve changesets there were reviewed by the specified person.
 
    The reviewer string matches the *r=* string specified in the commit. In
    the future, we may consult a database of known aliases, etc.
 
+reviewed()
+   Retrieve changesets that have a reviewer marked.
+
 tree(TREE)
    Retrieve changesets that are currently in the specified tree.
 
    Trees are specified with a known alias. e.g. ``tree(central)``.
 
    It's possible to see which changesets are in some tree but not others.
    e.g. to find changesets in *inbound* that haven't merged to *central*
    yet, do ``tree(inbound) - tree(central)``.
@@ -844,16 +847,26 @@ def revset_reviewer(repo, subset, x):
     """``reviewer(REVIEWER)``
     Changesets reviewed by a specific person.
     """
     n = revset.getstring(x, _('reviewer() requires a string argument.'))
 
     return [r for r in subset if n in parse_reviewers(repo[r].description())]
 
 
+def revset_reviewed(repo, subset, x):
+    """``reviewed()``
+    Changesets that were reviewed.
+    """
+    if x:
+        raise ParseError(_('reviewed() does not take an argument'))
+
+    return [r for r in subset if list(parse_reviewers(repo[r].description()))]
+
+
 def template_bug(repo, ctx, **args):
     """:bug: String. The bug this changeset is most associated with."""
     bugs = parse_bugs(ctx.description())
     return bugs[0] if bugs else None
 
 
 def template_bugs(repo, ctx, **args):
     """:bugs: List of ints. The bugs associated with this changeset."""
@@ -1042,16 +1055,17 @@ def extsetup(ui):
     extensions.wrapcommand(commands.table, 'pull', pullexpand)
 
     revset.symbols['bug'] = revset_bug
     revset.symbols['dontbuild'] = revset_dontbuild
     revset.symbols['me'] = revset_me
     revset.symbols['nobug'] = revset_nobug
     revset.symbols['pushhead'] = revset_pushhead
     revset.symbols['reviewer'] = revset_reviewer
+    revset.symbols['reviewed'] = revset_reviewed
     revset.symbols['tree'] = revset_tree
     revset.symbols['firstpushtree'] = revset_firstpushtree
 
     templatekw.keywords['bug'] = template_bug
     templatekw.keywords['bugs'] = template_bugs
     templatekw.keywords['reviewer'] = template_reviewer
     templatekw.keywords['reviewers'] = template_reviewers
     templatekw.keywords['firstrelease'] = template_firstrelease