revset: use `subset &` in `rev`
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 17 Sep 2014 11:00:09 -0700
changeset 22537 bbf4f3dfd700
parent 22536 8040a44aab1c
child 22538 a428db9ab61d
revset: use `subset &` in `rev` This takes advantage of the `fullreposet` smartness and yields a nice speedup. revset #0: rev(25) 0) wall 0.005480 comb 0.000000 user 0.000000 sys 0.000000 (best of 305) 1) wall 0.000052 comb 0.000000 user 0.000000 sys 0.000000 (best of 21891)
mercurial/revset.py
--- a/mercurial/revset.py	Wed Sep 17 19:52:34 2014 -0700
+++ b/mercurial/revset.py	Wed Sep 17 11:00:09 2014 -0700
@@ -1346,7 +1346,7 @@
     except (TypeError, ValueError):
         # i18n: "rev" is a keyword
         raise error.ParseError(_("rev expects a number"))
-    return subset.filter(lambda r: r == l)
+    return subset & baseset([l])
 
 def matching(repo, subset, x):
     """``matching(revision [, field])``