Add nobug() revset query
authorGregory Szorc <gps@mozilla.com>
Fri, 08 Nov 2013 00:51:46 -0800
changeset 67 40cd3c48f7817119e1f65f5cad8566bf78039079
parent 66 4a8116044c658cba94c6bab9bc92892fc262df36
child 68 1a0274f1ff870879696d163639630a08f68718b3
push id48
push usergszorc@mozilla.com
push dateFri, 08 Nov 2013 08:51:53 +0000
Add nobug() revset query
__init__.py
--- a/__init__.py
+++ b/__init__.py
@@ -123,16 +123,19 @@ dontbuild()
 
 me()
    Retrieve changesets that you are involved with.
 
    Currently, this only retrieves changesets you authored (via ui.username).
    In the future, this extension will index review syntax in commit messages
    and return changesets that you reviewed.
 
+nobug()
+   Retrieve changesets that don't reference a bug in the commit message.
+
 firstpushtree(TREE)
    Retrieve changesets that initially landed on the specified tree.
 
 tree(TREE)
    Retrieve changesets that are currently in the specified tree.
 
    Trees are specified with a known alias. e.g. ``tree(central)``.
 
@@ -724,16 +727,23 @@ def revset_me(repo, subset, x):
     for r in subset:
         if matcher(encoding.lower(repo[r].user())):
             yield r
             continue
 
         # TODO check reviewer blocks.
 
 
+def revset_nobug(repo, subset, x):
+    if x:
+        raise ParseError(_('nobug() does not take any arguments'))
+
+    return [r for r in subset if not parse_bugs(repo[r].description())]
+
+
 def revset_tree(repo, subset, x):
     """``tree(X)``
     Changesets currently in the specified Mozilla tree.
 
     A tree is the name of a repository. e.g. ``central``.
     """
     err = _('tree() requires a string argument.')
     tree = revset.getstring(x, err)
@@ -949,16 +959,17 @@ def extsetup(ui):
     except KeyError:
         pass
 
     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['tree'] = revset_tree
     revset.symbols['firstpushtree'] = revset_firstpushtree
 
     templatekw.keywords['bug'] = template_bug
     templatekw.keywords['bugs'] = template_bugs
     templatekw.keywords['firstrelease'] = template_firstrelease
     templatekw.keywords['firstbeta'] = template_firstbeta
     templatekw.keywords['firstaurora'] = template_firstaurora