Don't emit generators from revset queries
authorGregory Szorc <gps@mozilla.com>
Mon, 11 Nov 2013 10:40:36 -0800
changeset 358611 d9b9381b27ecf937ebda553a2185604ebb42c296
parent 358610 f9de32094538f08c41e494a9a7bf37e364977c53
child 358612 5c4756328ca412f17a4542a60ac389f8ab214fd8
push id16998
push userrwood@mozilla.com
push dateMon, 02 May 2016 19:42:03 +0000
Don't emit generators from revset queries
hgext/mozext/__init__.py
--- a/hgext/mozext/__init__.py
+++ b/hgext/mozext/__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())]