Patchwork [1,of,4] revset: added orderedlazyset class

login
register
mail settings
Submitter Lucas Moscovicz
Date Feb. 27, 2014, 10:12 p.m.
Message ID <730d872f70ae8b6d7b50.1393539168@dev1037.prn2.facebook.com>
Download mbox | patch
Permalink /patch/3787/
State Superseded
Headers show

Comments

Lucas Moscovicz - Feb. 27, 2014, 10:12 p.m.
# HG changeset patch
# User Lucas Moscovicz <lmoscovicz@fb.com>
# Date 1391642648 28800
#      Wed Feb 05 15:24:08 2014 -0800
# Node ID 730d872f70ae8b6d7b509cc31c6f85f02c1a1186
# Parent  11f983ebe4c1a2df8db42cc1bf1f8bba46b89967
revset: added orderedlazyset class

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2204,6 +2204,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, order=None):
+        super(orderedlazyset, self).__init__(subset, condition)
+        self._order = order
+
 class generatorset(object):
     """Wrapper structure for generators that provides lazy membership and can
     be iterated more than once.