revset: fix spanset.isascending() to honor sort() or reverse() request stable
authorYuya Nishihara <yuya@tcha.org>
Sat, 10 Jan 2015 21:31:59 +0900
branchstable
changeset 23826 c90d195320c5
parent 23734 f4e6475950f1
child 23833 9b1d3bac61a7
child 23918 db8e3f7948b1
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__.
mercurial/revset.py
tests/test-revset.t
--- 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))'