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

login
register
mail settings
Submitter Lucas Moscovicz
Date Feb. 11, 2014, 8:55 p.m.
Message ID <42080ca95bda3a82c773.1392152116@dev1037.prn2.facebook.com>
Download mbox | patch
Permalink /patch/3574/
State Accepted
Commit ad2f1512eaa618c7f1edf21a6c563c18e5bee43b
Headers show

Comments

Lucas Moscovicz - Feb. 11, 2014, 8:55 p.m.
# HG changeset patch
# User Lucas Moscovicz <lmoscovicz@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

Patch

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)``