revset: use `subset &` in bare `p2()`
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 17 Sep 2014 11:00:03 -0700
changeset 22539 6f434ef54222
parent 22538 a428db9ab61d
child 22540 9a860ac8c216
revset: use `subset &` in bare `p2()` This takes advantage of the `fullreposet` smartness with a nice speedup. It's a similar speedup to `p1()` when a merge is in progress (the non merge case is already lightning fast anyway.)
mercurial/revset.py
--- a/mercurial/revset.py	Wed Sep 17 10:59:52 2014 -0700
+++ b/mercurial/revset.py	Wed Sep 17 11:00:03 2014 -0700
@@ -1217,7 +1217,9 @@
         ps = repo[x].parents()
         try:
             p = ps[1].rev()
-            return subset.filter(lambda r: r == p)
+            if p >= 0:
+                return subset & baseset([p])
+            return baseset([])
         except IndexError:
             return baseset([])