##// END OF EJS Templates
lazyset: rename the class to filteredset...
Pierre-Yves David -
r22726:169aa5e7 default
parent child Browse files
Show More
@@ -409,7 +409,7 b' def only(repo, subset, x):'
409 409 exclude = getset(repo, spanset(repo), args[1])
410 410
411 411 results = set(ancestormod.missingancestors(include, exclude, cl.parentrevs))
412 return lazyset(subset, results.__contains__)
412 return filteredset(subset, results.__contains__)
413 413
414 414 def bisect(repo, subset, x):
415 415 """``bisect(string)``
@@ -668,8 +668,8 b' def _descendants(repo, subset, x, follow'
668 668 result = (orderedlazyset(s, subset.__contains__, ascending=True) +
669 669 orderedlazyset(args, subset.__contains__, ascending=True))
670 670
671 # Wrap result in a lazyset since it's an _addset, which doesn't implement
672 # all the necessary functions to be consumed by callers.
671 # Wrap result in a filteredset since it's an _addset, which doesn't
672 # implement all the necessary functions to be consumed by callers.
673 673 return orderedlazyset(result, lambda r: True, ascending=True)
674 674
675 675 def descendants(repo, subset, x):
@@ -2330,7 +2330,7 b' class baseset(list, abstractsmartset):'
2330 2330
2331 2331 This is part of the mandatory API for smartset."""
2332 2332 # If we are operating on 2 baseset, do the computation now since all
2333 # data is available. The alternative is to involve a lazyset, which
2333 # data is available. The alternative is to involve a filteredset, which
2334 2334 # may be slow.
2335 2335 if isinstance(other, baseset):
2336 2336 other = other.set()
@@ -2371,7 +2371,7 b' class baseset(list, abstractsmartset):'
2371 2371 boolean.
2372 2372
2373 2373 This is part of the mandatory API for smartset."""
2374 return lazyset(self, condition)
2374 return filteredset(self, condition)
2375 2375
2376 2376 class _orderedsetmixin(object):
2377 2377 """Mixin class with utility methods for smartsets
@@ -2404,7 +2404,7 b' class _orderedsetmixin(object):'
2404 2404 return self._last()
2405 2405 return self._first()
2406 2406
2407 class lazyset(abstractsmartset):
2407 class filteredset(abstractsmartset):
2408 2408 """Duck type for baseset class which iterates lazily over the revisions in
2409 2409 the subset and contains a function which tests for membership in the
2410 2410 revset
@@ -2452,10 +2452,10 b' class lazyset(abstractsmartset):'
2452 2452 return lambda: self._iterfilter(it())
2453 2453
2454 2454 def __and__(self, x):
2455 return lazyset(self, x.__contains__)
2455 return filteredset(self, x.__contains__)
2456 2456
2457 2457 def __sub__(self, x):
2458 return lazyset(self, lambda r: r not in x)
2458 return filteredset(self, lambda r: r not in x)
2459 2459
2460 2460 def __add__(self, x):
2461 2461 return _addset(self, x)
@@ -2499,10 +2499,10 b' class lazyset(abstractsmartset):'
2499 2499 return self._ascending is not None and not self._ascending
2500 2500
2501 2501 def filter(self, l):
2502 return lazyset(self, l)
2503
2504 class orderedlazyset(_orderedsetmixin, lazyset):
2505 """Subclass of lazyset which subset can be ordered either ascending or
2502 return filteredset(self, l)
2503
2504 class orderedlazyset(_orderedsetmixin, filteredset):
2505 """Subclass of filteredset which subset can be ordered either ascending or
2506 2506 descendingly
2507 2507 """
2508 2508 def __init__(self, subset, condition, ascending=True):
@@ -2587,7 +2587,7 b' class _addset(_orderedsetmixin):'
2587 2587 def filter(self, condition):
2588 2588 if self._ascending is not None:
2589 2589 return orderedlazyset(self, condition, ascending=self._ascending)
2590 return lazyset(self, condition)
2590 return filteredset(self, condition)
2591 2591
2592 2592 def ascending(self):
2593 2593 if self._ascending is None:
@@ -2609,13 +2609,13 b' class _addset(_orderedsetmixin):'
2609 2609 filterfunc = other.__contains__
2610 2610 if self._ascending is not None:
2611 2611 return orderedlazyset(self, filterfunc, ascending=self._ascending)
2612 return lazyset(self, filterfunc)
2612 return filteredset(self, filterfunc)
2613 2613
2614 2614 def __sub__(self, other):
2615 2615 filterfunc = lambda r: r not in other
2616 2616 if self._ascending is not None:
2617 2617 return orderedlazyset(self, filterfunc, ascending=self._ascending)
2618 return lazyset(self, filterfunc)
2618 return filteredset(self, filterfunc)
2619 2619
2620 2620 def __add__(self, other):
2621 2621 """When both collections are ascending or descending, preserve the order
General Comments 0
You need to be logged in to leave comments. Login now