changeset 20712:c152e538b85b

revset: added ascending attribute to addset class In case both collections are in an ascending/descending order then we will be able to iterate them lazily while keeping the order.
author Lucas Moscovicz <lmoscovicz@fb.com>
date Tue, 11 Mar 2014 16:52:15 -0700
parents b95490cf8abd
children 6a1a4c212d50 b93791e0de25
files mercurial/revset.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Mon Mar 10 10:49:04 2014 -0700
+++ b/mercurial/revset.py	Tue Mar 11 16:52:15 2014 -0700
@@ -2312,13 +2312,18 @@
     Wrapper structure for lazily adding two structures without losing much
     performance on the __contains__ method
 
+    If the ascending attribute is set, that means the two structures are
+    ordered in either an ascending or descending way. Therefore, we can add
+    them mantaining the order by iterating over both at the same time
+
     This class does not duck-type baseset and it's only supposed to be used
     internally
     """
-    def __init__(self, revs1, revs2):
+    def __init__(self, revs1, revs2, ascending=None):
         self._r1 = revs1
         self._r2 = revs2
         self._iter = None
+        self._ascending = ascending
 
     def _iterator(self):
         if not self._iter: