changeset 22687:d9cc1be5acec

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.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 01 Oct 2014 15:53:42 -0500
parents 2717dcff7be1
children cac9b3591753
files mercurial/revset.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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):