changeset 22482:2e40cda4b2c5

revset: use spanset.isdescending in multiple simple places We call the method directly instead of duplicating checks. Benchmarks show no performances harmed in the process.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 16 Sep 2014 23:37:03 -0700
parents 8488955127b0
children a21d04848359
files mercurial/revset.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Tue Sep 16 23:34:18 2014 -0700
+++ b/mercurial/revset.py	Tue Sep 16 23:37:03 2014 -0700
@@ -2747,15 +2747,15 @@
         self._hiddenrevs = repo.changelog.filteredrevs
 
     def ascending(self):
-        if self._start > self._end:
+        if not self.isascending():
             self.reverse()
 
     def descending(self):
-        if self._start < self._end:
+        if not self.isdescending():
             self.reverse()
 
     def __iter__(self):
-        if self._start <= self._end:
+        if self.isascending():
             iterrange = xrange(self._start, self._end)
         else:
             iterrange = xrange(self._start, self._end, -1)
@@ -2826,7 +2826,7 @@
 
     def reverse(self):
         # Just switch the _start and _end parameters
-        if self._start <= self._end:
+        if self.isascending():
             self._start, self._end = self._end - 1, self._start - 1
         else:
             self._start, self._end = self._end + 1, self._start + 1