changeset 22538:a428db9ab61d

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)
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 17 Sep 2014 10:59:52 -0700
parents bbf4f3dfd700
children 6f434ef54222
files mercurial/revset.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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