diff --git a/mercurial/revset.py b/mercurial/revset.py
index 40a2cf1c765bf6e10e150b9b6cdaeec6acf7eb26_bWVyY3VyaWFsL3JldnNldC5weQ==..a94ef7f517e04b5c64cd3a0c73d737ac580c508b_bWVyY3VyaWFsL3JldnNldC5weQ== 100644
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -3047,5 +3047,5 @@
         # try to use our own fast iterator if it exists
         self._trysetasclist()
         if self._ascending:
-            it = self.fastasc
+            attr = 'fastasc'
         else:
@@ -3051,5 +3051,6 @@
         else:
-            it = self.fastdesc
+            attr = 'fastdesc'
+        it = getattr(self, attr)
         if it is not None:
             return it()
         # maybe half of the component supports fast
@@ -3053,9 +3054,6 @@
         if it is not None:
             return it()
         # maybe half of the component supports fast
-        attr = 'fastdesc'
-        if self._ascending:
-            attr = 'fastasc'
         # get iterator for _r1
         iter1 = getattr(self._r1, attr)
         if iter1 is None: