revset: use spanset.isdescending in multiple simple places
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 16 Sep 2014 23:37:03 -0700
changeset 22482 2e40cda4b2c5
parent 22481 8488955127b0
child 22483 a21d04848359
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.
mercurial/revset.py
--- 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