changeset 22863:a1a02b516cca

baseset: empty or one-element sets are ascending and descending The empty set is full of interesting properties. In the ordering case, the one element set is too.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 09 Oct 2014 04:12:20 -0700
parents 9e5576f822cc
children 96b6b3d78697
files mercurial/revset.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Tue Oct 07 01:33:05 2014 -0700
+++ b/mercurial/revset.py	Thu Oct 09 04:12:20 2014 -0700
@@ -2368,12 +2368,16 @@
         """Returns True if the collection is ascending order, False if not.
 
         This is part of the mandatory API for smartset."""
+        if len(self) <= 1:
+            return True
         return self._ascending is not None and self._ascending
 
     def isdescending(self):
         """Returns True if the collection is descending order, False if not.
 
         This is part of the mandatory API for smartset."""
+        if len(self) <= 1:
+            return True
         return self._ascending is not None and not self._ascending
 
     def first(self):