changeset 23826:c90d195320c5 stable

revset: fix spanset.isascending() to honor sort() or reverse() request Because spanset.isascending() ignored the ascending flag, the result of "fullreposet() & x" was always sorted in ascending order. The test case is carefully chosen to call fullreposet.__and__.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 10 Jan 2015 21:31:59 +0900
parents f4e6475950f1
children 9b1d3bac61a7 db8e3f7948b1
files mercurial/revset.py tests/test-revset.t
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Mon Jan 05 22:18:55 2015 -0800
+++ b/mercurial/revset.py	Sat Jan 10 21:31:59 2015 +0900
@@ -2913,10 +2913,10 @@
             return abs(self._end - self._start) - count
 
     def isascending(self):
-        return self._start <= self._end
+        return self._ascending
 
     def isdescending(self):
-        return self._start >= self._end
+        return not self._ascending
 
     def first(self):
         if self._ascending:
--- a/tests/test-revset.t	Mon Jan 05 22:18:55 2015 -0800
+++ b/tests/test-revset.t	Sat Jan 10 21:31:59 2015 +0900
@@ -496,6 +496,9 @@
   2
   1
   0
+  $ log 'reverse(all()) & filelog(b)'
+  4
+  1
   $ log 'rev(5)'
   5
   $ log 'sort(limit(reverse(all()), 3))'