revset-phases: do not cache phase-related filters
authorPierre-Yves David <pierre-yves.david@fb.com>
Sat, 11 Oct 2014 01:21:47 -0700
changeset 23018 73d9d5548dfe
parent 23017 dc25ed84bee8
child 23019 c8f32accd00a
revset-phases: do not cache phase-related filters The phase retrieval is fast enough to not require caching the result of the functions. draft() 0) wall 0.017209 comb 0.020000 user 0.020000 sys 0.000000 (best of 149) 1) wall 0.011654 comb 0.010000 user 0.010000 sys 0.000000 (best of 186) public() 0) wall 0.018687 comb 0.010000 user 0.010000 sys 0.000000 (best of 128) 1) wall 0.013290 comb 0.010000 user 0.010000 sys 0.000000 (best of 181) secret() 0) wall 0.017464 comb 0.020000 user 0.020000 sys 0.000000 (best of 127) 1) wall 0.011499 comb 0.000000 user 0.000000 sys 0.000000 (best of 196) draft() - ::bookmark() 0) wall 0.020099 comb 0.020000 user 0.020000 sys 0.000000 (best of 127) 1) wall 0.014399 comb 0.020000 user 0.020000 sys 0.000000 (best of 169)
mercurial/revset.py
--- a/mercurial/revset.py	Wed Oct 15 20:37:44 2014 -0700
+++ b/mercurial/revset.py	Sat Oct 11 01:21:47 2014 -0700
@@ -744,7 +744,8 @@
     # i18n: "draft" is a keyword
     getargs(x, 0, 0, _("draft takes no arguments"))
     pc = repo._phasecache
-    return subset.filter(lambda r: pc.phase(repo, r) == phases.draft)
+    condition = lambda r: pc.phase(repo, r) == phases.draft
+    return subset.filter(condition, cache=False)
 
 def extinct(repo, subset, x):
     """``extinct()``
@@ -1294,7 +1295,8 @@
     # i18n: "public" is a keyword
     getargs(x, 0, 0, _("public takes no arguments"))
     pc = repo._phasecache
-    return subset.filter(lambda r: pc.phase(repo, r) == phases.public)
+    condition = lambda r: pc.phase(repo, r) == phases.public
+    return subset.filter(condition, cache=False)
 
 def remote(repo, subset, x):
     """``remote([id [,path]])``
@@ -1492,7 +1494,8 @@
     # i18n: "secret" is a keyword
     getargs(x, 0, 0, _("secret takes no arguments"))
     pc = repo._phasecache
-    return subset.filter(lambda x: pc.phase(repo, x) == phases.secret)
+    condition = lambda x: pc.phase(repo, x) == phases.secret
+    return subset.filter(condition, cache=False)
 
 def sort(repo, subset, x):
     """``sort(set[, [-]key...])``