changeset 20447:abb91b74f758

revset: added lazyset implementation to keyword revset Performance benchmarking: $ time hg log -qr "first(keyword(changeset))" 0:9117c6561b0b real 0m3.466s user 0m3.345s sys 0m0.072s $ time ./hg log -qr "first(keyword(changeset))" 0:9117c6561b0b real 0m0.365s user 0m0.199s sys 0m0.083s
author Lucas Moscovicz <lmoscovicz@fb.com>
date Wed, 29 Jan 2014 09:04:03 -0800
parents d258486604f4
children 92f6f2db3cf4
files mercurial/revset.py
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Tue Jan 28 16:19:30 2014 -0800
+++ b/mercurial/revset.py	Wed Jan 29 09:04:03 2014 -0800
@@ -921,13 +921,13 @@
     """
     # i18n: "keyword" is a keyword
     kw = encoding.lower(getstring(x, _("keyword requires a string")))
-    l = []
-    for r in subset:
+
+    def matches(r):
         c = repo[r]
-        if util.any(kw in encoding.lower(t)
-                    for t in c.files() + [c.user(), c.description()]):
-            l.append(r)
-    return baseset(l)
+        return util.any(kw in encoding.lower(t) for t in c.files() + [c.user(),
+            c.description()])
+
+    return lazyset(subset, matches)
 
 def limit(repo, subset, x):
     """``limit(set, [n])``