[PATCH 1 of 2] revset: use fastasc/fastdesc switch consistently in addset.__iter__

Yuya Nishihara yuya at tcha.org
Sun May 17 23:00:43 UTC 2015


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1431752702 -32400
#      Sat May 16 14:05:02 2015 +0900
# Node ID caa306fbcfcea29fa9683cf646d43ddeb4d52477
# Parent  b30196956327136b7ae08c29bb4819671ceea897
revset: use fastasc/fastdesc switch consistently in addset.__iter__

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -3047,15 +3047,13 @@ class addset(abstractsmartset):
         # try to use our own fast iterator if it exists
         self._trysetasclist()
         if self._ascending:
-            it = self.fastasc
+            attr = 'fastasc'
         else:
-            it = self.fastdesc
+            attr = 'fastdesc'
+        it = getattr(self, attr)
         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:


More information about the Mercurial-devel mailing list