revset: changed smartset methods to return ordered addsets
Now when adding two structures that are ordered, they are wrapped into an
_addset and they get added lazily while keeping the order.
--- a/mercurial/revset.py Fri Mar 14 10:24:09 2014 -0700
+++ b/mercurial/revset.py Tue Mar 11 17:25:53 2014 -0700
@@ -2283,7 +2283,7 @@
return lazyset(self, lambda r: r not in x)
def __add__(self, x):
- return lazyset(_addset(self, x))
+ return _addset(self, x)
def __nonzero__(self):
for r in self:
@@ -2347,6 +2347,14 @@
return orderedlazyset(self, lambda r: r not in x,
ascending=self._ascending)
+ def __add__(self, x):
+ kwargs = {}
+ if self.isascending() and x.isascending():
+ kwargs['ascending'] = True
+ if self.isdescending() and x.isdescending():
+ kwargs['ascending'] = False
+ return _addset(self, x, **kwargs)
+
def sort(self, reverse=False):
if reverse:
if self._ascending:
@@ -2694,7 +2702,12 @@
return orderedlazyset(self, lambda r: r not in x, ascending=False)
def __add__(self, x):
- return lazyset(_addset(self, x))
+ kwargs = {}
+ if self.isascending() and x.isascending():
+ kwargs['ascending'] = True
+ if self.isdescending() and x.isdescending():
+ kwargs['ascending'] = False
+ return _addset(self, x, **kwargs)
def __len__(self):
if not self._hiddenrevs: