# HG changeset patch # User Pierre-Yves David # Date 2014-10-09 11:12:20 # Node ID a1a02b516cca2d2df4f082fa977d56b1ca177865 # Parent 9e5576f822ccd2d21cae046b664c68bbeb667e6c 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. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2368,12 +2368,16 @@ class baseset(abstractsmartset): """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):