[PATCH 1 of 8] revset: added lazyset implementation to date revset

Lucas Moscovicz lmoscovicz at fb.com
Tue Feb 11 14:55:16 CST 2014


# HG changeset patch
# User Lucas Moscovicz <lmoscovicz at fb.com>
# Date 1391472168 28800
#      Mon Feb 03 16:02:48 2014 -0800
# Node ID 42080ca95bda3a82c7738e23d77785107de41bf8
# Parent  9bca7c192a62d916e3a91cc305db9d7594ffcb03
revset: added lazyset implementation to date revset

Performance Benchmarking:

$ time hg log -qr "first(date(05/03/2005))"
0:9117c6561b0b

real  0m3.157s
user  0m2.994s
sys 0m0.087s

$ time ./hg log -qr "first(date(05/03/2005))"
0:9117c6561b0b

real  0m0.509s
user  0m0.289s
sys 0m0.070s

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -582,7 +582,7 @@
     # i18n: "date" is a keyword
     ds = getstring(x, _("date requires a string"))
     dm = util.matchdate(ds)
-    return baseset([r for r in subset if dm(repo[r].date()[0])])
+    return lazyset(subset, lambda x: dm(repo[x].date()[0]))
 
 def desc(repo, subset, x):
     """``desc(string)``


More information about the Mercurial-devel mailing list