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

login
register
mail settings
Submitter Lucas Moscovicz
Date Feb. 27, 2014, 11:54 p.m.
Message ID <8ed224ecdf558b57481b.1393545249@dev1037.prn2.facebook.com>
Download mbox | patch
Permalink /patch/3797/
State Accepted
Commit 56ecc82fcd6717c4d928cad40afe6b791c36d554
Headers show

Comments

Lucas Moscovicz - Feb. 27, 2014, 11:54 p.m.
# HG changeset patch
# User Lucas Moscovicz <lmoscovicz@fb.com>
# Date 1391642648 28800
#      Wed Feb 05 15:24:08 2014 -0800
# Node ID 8ed224ecdf558b57481b5d21cd9d4944f70dec0f
# 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, 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.