spanset: do a single range check in __contains__
authorPierre-Yves David <pierre-yves.david@fb.com>
Thu, 02 Oct 2014 17:53:55 -0500
changeset 22718 7b123e5639f4
parent 22717 b89f7e3a414d
child 22719 21fda9dcd4e8
spanset: do a single range check in __contains__ Now that `start <= end` is always true, we can simplify this function.
mercurial/revset.py
--- a/mercurial/revset.py	Thu Oct 02 18:02:17 2014 -0500
+++ b/mercurial/revset.py	Thu Oct 02 17:53:55 2014 -0500
@@ -2895,10 +2895,8 @@
         return iter(iterrange)
 
     def __contains__(self, rev):
-        start = self._start
-        end = self._end
         hidden = self._hiddenrevs
-        return (((end < rev <= start) or (start <= rev and rev < end))
+        return ((self._start <= rev < self._end)
                 and not (hidden and rev in hidden))
 
     def __nonzero__(self):