changeset 20693:d04aac468bf4

revset: changed _children method to use lazy structures
author Lucas Moscovicz <lmoscovicz@fb.com>
date Tue, 11 Feb 2014 14:03:43 -0800
parents 7af341082b76
children 621c94378d0d
files mercurial/revset.py
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Mon Feb 10 12:26:45 2014 -0800
+++ b/mercurial/revset.py	Tue Feb 11 14:03:43 2014 -0800
@@ -540,18 +540,19 @@
     return subset.filter(matches)
 
 def _children(repo, narrow, parentset):
-    cs = set()
     if not parentset:
-        return baseset(cs)
+        return baseset([])
     pr = repo.changelog.parentrevs
     minrev = min(parentset)
-    for r in narrow:
-        if r <= minrev:
-            continue
-        for p in pr(r):
+
+    def matches(x):
+        if x <= minrev:
+            return False
+        for p in pr(x):
             if p in parentset:
-                cs.add(r)
-    return baseset(cs)
+                return True
+
+    return narrow.filter(matches)
 
 def children(repo, subset, x):
     """``children(set)``