revset: added lazyset implementation to merge revset
authorLucas Moscovicz <lmoscovicz@fb.com>
Thu, 30 Jan 2014 16:47:29 -0800
changeset 20454 47fd57f650e5
parent 20453 6aa7dcae6bd8
child 20455 a2c08adbb86e
revset: added lazyset implementation to merge revset Performance benchmarking: $ time hg log -qr "first(merge())" 102:58039eddbdda real 0m0.276s user 0m0.208s sys 0m0.047s $ time ./hg log -qr "first(merge())" 102:58039eddbdda real 0m0.192s user 0m0.154s sys 0m0.027s
mercurial/revset.py
--- a/mercurial/revset.py	Thu Jan 30 16:03:18 2014 -0800
+++ b/mercurial/revset.py	Thu Jan 30 16:47:29 2014 -0800
@@ -992,7 +992,7 @@
     # i18n: "merge" is a keyword
     getargs(x, 0, 0, _("merge takes no arguments"))
     cl = repo.changelog
-    return baseset([r for r in subset if cl.parentrevs(r)[1] != -1])
+    return lazyset(subset, lambda r: cl.parentrevs(r)[1] != -1)
 
 def branchpoint(repo, subset, x):
     """``branchpoint()``