Don't emit generators from revset queries
authorGregory Szorc <gps@mozilla.com>
Mon, 11 Nov 2013 10:40:36 -0800
changeset 76 03156d8451c91b8cd6268409af29c8ecc5349e5b
parent 75 7157ce9546037b4e21d42f931d2b16974dd8ec23
child 77 ce54350967e74f08b993f0d8691f7bb06452e81a
push id55
push usergszorc@mozilla.com
push dateMon, 11 Nov 2013 18:40:39 +0000
Don't emit generators from revset queries
__init__.py
--- a/__init__.py
+++ b/__init__.py
@@ -746,27 +746,31 @@ def revset_me(repo, subset, x):
     if not me:
         raise util.Abort(_('"[ui] username" must be set to use me()'))
 
     ircnick = repo.ui.config('mozext', 'ircnick')
 
     n = encoding.lower(me)
     kind, pattern, matcher = revset._substringmatcher(n)
 
+    revs = []
+
     for r in subset:
         ctx = repo[r]
         if matcher(encoding.lower(ctx.user())):
-            yield r
+            revs.append(r)
             continue
 
         if ircnick:
             if ircnick in parse_reviewers(ctx.description()):
-                yield r
+                revs.append(r)
                 continue
 
+    return revs
+
 
 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())]
 
 
@@ -793,47 +797,55 @@ def revset_tree(repo, subset, x):
 
 def revset_firstpushdate(repo, subset, x):
     """``firstpushdate(DATE)``
     Changesets that were initially pushed according to the date spec provided.
     """
     ds = revset.getstring(x, _('firstpushdate() requires a string'))
     dm = util.matchdate(ds)
 
+    revs = []
+
     for rev in subset:
         pushes = list(repo.changetracker.pushes_for_changeset(repo[rev].node()))
 
         if not pushes:
             continue
 
         when = pushes[0][2]
 
         if dm(when):
-            yield rev
+            revs.append(rev)
+
+    return revs
 
 
 def revset_firstpushtree(repo, subset, x):
     """``firstpushtree(X)``
     Changesets that were initially pushed to tree X.
     """
     tree = revset.getstring(x, _('firstpushtree() requires a string argument.'))
 
     tree, uri = resolve_trees_to_uris([tree])[0]
     if not uri:
         raise util.Abort(_("Don't know about tree: %s") % tree)
 
+    revs = []
+
     for rev in subset:
         pushes = list(repo.changetracker.pushes_for_changeset(
             repo[rev].node()))
 
         if not pushes:
             continue
 
         if pushes[0][0] == tree:
-            yield rev
+            revs.append(rev)
+
+    return revs
 
 
 def revset_pushhead(repo, subset, x):
     """``pushhead([TREE])``
     Changesets that are push heads.
 
     A push head is a changeset that was a head when it was pushed to a
     repository. In other words, the automation infrastructure likely
@@ -853,30 +865,30 @@ def revset_pushhead(repo, subset, x):
         tree, uri = resolve_trees_to_uris([tree])[0]
 
         if not uri:
             raise util.Abort(_("Don't know about tree: %s") % tree)
 
         heads = set(repo[r[4]].rev() for r in
             repo.changetracker.tree_push_heads(tree))
 
-        for r in subset:
-            if r in heads:
-                yield r
+        return [r for r in subset if r in heads]
 
-        return
+    revs = []
 
     for r in subset:
         node = repo[r].node()
 
         for push in repo.changetracker.pushes_for_changeset(node):
             if str(push[4]) == node:
-                yield r
+                revs.append(r)
                 break
 
+    return revs
+
 
 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())]