comparison mercurial/revset.py @ 20609:56ecc82fcd67

revset: added orderedlazyset class
author Lucas Moscovicz <lmoscovicz@fb.com>
date Wed, 05 Feb 2014 15:24:08 -0800
parents cb18fe3461b1
children 34bb07e70c68
comparison
equal deleted inserted replaced
20608:a3ca1d032926 20609:56ecc82fcd67
2208 self._subset.reverse() 2208 self._subset.reverse()
2209 2209
2210 def set(self): 2210 def set(self):
2211 return set([r for r in self]) 2211 return set([r for r in self])
2212 2212
2213 class orderedlazyset(lazyset):
2214 """Subclass of lazyset which subset can be ordered either ascending or
2215 descendingly
2216 """
2217 def __init__(self, subset, condition, ascending=True):
2218 super(orderedlazyset, self).__init__(subset, condition)
2219 self._ascending = ascending
2220
2213 class generatorset(object): 2221 class generatorset(object):
2214 """Wrapper structure for generators that provides lazy membership and can 2222 """Wrapper structure for generators that provides lazy membership and can
2215 be iterated more than once. 2223 be iterated more than once.
2216 When asked for membership it generates values until either it finds the 2224 When asked for membership it generates values until either it finds the
2217 requested one or has gone through all the elements in the generator 2225 requested one or has gone through all the elements in the generator