[PATCH STABLE] revset: fix spanset.isascending() to honor sort() or reverse() request
Yuya Nishihara
yuya at tcha.org
Sat Jan 10 15:44:45 UTC 2015
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1420893119 -32400
# Sat Jan 10 21:31:59 2015 +0900
# Branch stable
# Node ID 0afe584fbc307bf52b8508cd37c273ff8581ec39
# Parent f4e6475950f18a08663c2f4ea8f6352a1b0b55fa
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__.
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2913,10 +2913,10 @@ class _spanset(abstractsmartset):
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:
diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -496,6 +496,9 @@ Test explicit numeric revision
2
1
0
+ $ log 'reverse(all()) & filelog(b)'
+ 4
+ 1
$ log 'rev(5)'
5
$ log 'sort(limit(reverse(all()), 3))'
More information about the Mercurial-devel
mailing list