revset: use `subset &` in bare `p1()`
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 17 Sep 2014 10:59:52 -0700
changeset 22538 a428db9ab61d
parent 22537 bbf4f3dfd700
child 22539 6f434ef54222
revset: use `subset &` in bare `p1()` This takes advantage of the `fullreposet` smartness and yields a nice speedup. revset #0: p1() 0) wall 0.003256 comb 0.010000 user 0.010000 sys 0.000000 (best of 527) 1) wall 0.000066 comb 0.000000 user 0.000000 sys 0.000000 (best of 23224)
mercurial/revset.py
--- a/mercurial/revset.py	Wed Sep 17 11:00:09 2014 -0700
+++ b/mercurial/revset.py	Wed Sep 17 10:59:52 2014 -0700
@@ -1198,7 +1198,9 @@
     """
     if x is None:
         p = repo[x].p1().rev()
-        return subset.filter(lambda r: r == p)
+        if p >= 0:
+            return subset & baseset([p])
+        return baseset([])
 
     ps = set()
     cl = repo.changelog