revset: added orderedlazyset class
authorLucas Moscovicz <lmoscovicz@fb.com>
Wed, 05 Feb 2014 15:24:08 -0800
changeset 20609 56ecc82fcd67
parent 20608 a3ca1d032926
child 20610 34bb07e70c68
revset: added orderedlazyset class
mercurial/revset.py
--- a/mercurial/revset.py	Thu Feb 27 23:17:37 2014 -0600
+++ b/mercurial/revset.py	Wed Feb 05 15:24:08 2014 -0800
@@ -2210,6 +2210,14 @@
     def set(self):
         return set([r for r in self])
 
+class orderedlazyset(lazyset):
+    """Subclass of lazyset which subset can be ordered either ascending or
+    descendingly
+    """
+    def __init__(self, subset, condition, ascending=True):
+        super(orderedlazyset, self).__init__(subset, condition)
+        self._ascending = ascending
+
 class generatorset(object):
     """Wrapper structure for generators that provides lazy membership and can
     be iterated more than once.