changeset 22726:169aa5e74b52

lazyset: rename the class to filteredset All smartsets try to be lazy. The purpose of this class is to apply a filter on another set. So we rename the class (and all its occurences) to `filteredset`.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 03 Oct 2014 01:16:23 -0500
parents 88e5483bfb20
children 0f3e240a1c35
files mercurial/revset.py
diffstat 1 files changed, 15 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Thu Oct 02 19:14:03 2014 -0500
+++ b/mercurial/revset.py	Fri Oct 03 01:16:23 2014 -0500
@@ -409,7 +409,7 @@
         exclude = getset(repo, spanset(repo), args[1])
 
     results = set(ancestormod.missingancestors(include, exclude, cl.parentrevs))
-    return lazyset(subset, results.__contains__)
+    return filteredset(subset, results.__contains__)
 
 def bisect(repo, subset, x):
     """``bisect(string)``
@@ -668,8 +668,8 @@
     result = (orderedlazyset(s, subset.__contains__, ascending=True) +
               orderedlazyset(args, subset.__contains__, ascending=True))
 
-    # Wrap result in a lazyset since it's an _addset, which doesn't implement
-    # all the necessary functions to be consumed by callers.
+    # Wrap result in a filteredset since it's an _addset, which doesn't
+    # implement all the necessary functions to be consumed by callers.
     return orderedlazyset(result, lambda r: True, ascending=True)
 
 def descendants(repo, subset, x):
@@ -2330,7 +2330,7 @@
 
         This is part of the mandatory API for smartset."""
         # If we are operating on 2 baseset, do the computation now since all
-        # data is available. The alternative is to involve a lazyset, which
+        # data is available. The alternative is to involve a filteredset, which
         # may be slow.
         if isinstance(other, baseset):
             other = other.set()
@@ -2371,7 +2371,7 @@
         boolean.
 
         This is part of the mandatory API for smartset."""
-        return lazyset(self, condition)
+        return filteredset(self, condition)
 
 class _orderedsetmixin(object):
     """Mixin class with utility methods for smartsets
@@ -2404,7 +2404,7 @@
             return self._last()
         return self._first()
 
-class lazyset(abstractsmartset):
+class filteredset(abstractsmartset):
     """Duck type for baseset class which iterates lazily over the revisions in
     the subset and contains a function which tests for membership in the
     revset
@@ -2452,10 +2452,10 @@
         return lambda: self._iterfilter(it())
 
     def __and__(self, x):
-        return lazyset(self, x.__contains__)
+        return filteredset(self, x.__contains__)
 
     def __sub__(self, x):
-        return lazyset(self, lambda r: r not in x)
+        return filteredset(self, lambda r: r not in x)
 
     def __add__(self, x):
         return _addset(self, x)
@@ -2499,10 +2499,10 @@
         return self._ascending is not None and not self._ascending
 
     def filter(self, l):
-        return lazyset(self, l)
-
-class orderedlazyset(_orderedsetmixin, lazyset):
-    """Subclass of lazyset which subset can be ordered either ascending or
+        return filteredset(self, l)
+
+class orderedlazyset(_orderedsetmixin, filteredset):
+    """Subclass of filteredset which subset can be ordered either ascending or
     descendingly
     """
     def __init__(self, subset, condition, ascending=True):
@@ -2587,7 +2587,7 @@
     def filter(self, condition):
         if self._ascending is not None:
             return orderedlazyset(self, condition, ascending=self._ascending)
-        return lazyset(self, condition)
+        return filteredset(self, condition)
 
     def ascending(self):
         if self._ascending is None:
@@ -2609,13 +2609,13 @@
         filterfunc = other.__contains__
         if self._ascending is not None:
             return orderedlazyset(self, filterfunc, ascending=self._ascending)
-        return lazyset(self, filterfunc)
+        return filteredset(self, filterfunc)
 
     def __sub__(self, other):
         filterfunc = lambda r: r not in other
         if self._ascending is not None:
             return orderedlazyset(self, filterfunc, ascending=self._ascending)
-        return lazyset(self, filterfunc)
+        return filteredset(self, filterfunc)
 
     def __add__(self, other):
         """When both collections are ascending or descending, preserve the order