revset: use direct access to __contains__ in spanset.__sub__
Using `x.__contains__(r)` instead of `r in x` does not matter for built-in type
(set) but have a positive impact for all other classes. This will let us drop
some usage of baseset.set() in future patches. This also probably improves some
performance.
--- a/mercurial/revset.py Tue Sep 30 12:39:21 2014 -0500
+++ b/mercurial/revset.py Wed Oct 01 15:53:42 2014 -0500
@@ -2823,7 +2823,8 @@
def __sub__(self, x):
if isinstance(x, baseset):
x = x.set()
- return orderedlazyset(self, lambda r: r not in x,
+ filterfunc = x.__contains__
+ return orderedlazyset(self, lambda r: not filterfunc(r),
ascending=self.isascending())
def __add__(self, x):