comparison mercurial/revset.py @ 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
comparison
equal deleted inserted replaced
22862:9e5576f822cc 22863:a1a02b516cca
2366 2366
2367 def isascending(self): 2367 def isascending(self):
2368 """Returns True if the collection is ascending order, False if not. 2368 """Returns True if the collection is ascending order, False if not.
2369 2369
2370 This is part of the mandatory API for smartset.""" 2370 This is part of the mandatory API for smartset."""
2371 if len(self) <= 1:
2372 return True
2371 return self._ascending is not None and self._ascending 2373 return self._ascending is not None and self._ascending
2372 2374
2373 def isdescending(self): 2375 def isdescending(self):
2374 """Returns True if the collection is descending order, False if not. 2376 """Returns True if the collection is descending order, False if not.
2375 2377
2376 This is part of the mandatory API for smartset.""" 2378 This is part of the mandatory API for smartset."""
2379 if len(self) <= 1:
2380 return True
2377 return self._ascending is not None and not self._ascending 2381 return self._ascending is not None and not self._ascending
2378 2382
2379 def first(self): 2383 def first(self):
2380 if self: 2384 if self:
2381 if self._ascending is None: 2385 if self._ascending is None: