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

login
register
mail settings
Submitter Yuya Nishihara
Date May 17, 2015, 11 p.m.
Message ID <caa306fbcfcea29fa968.1431903643@mimosa>
Download mbox | patch
Permalink /patch/9121/
State Accepted
Headers show

Comments

Yuya Nishihara - May 17, 2015, 11 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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__

Patch

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: