changeset 20721:d642f176df52

revset: changed _iterator() in addset to use the generated list when available Now when all the elements have been generated, the iterator will just use the generated list instead of going through all the elements again.
author Lucas Moscovicz <lmoscovicz@fb.com>
date Thu, 13 Mar 2014 14:51:04 -0700
parents 5f8400efca0b
children 6894223ebc38
files mercurial/revset.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Tue Mar 11 16:59:42 2014 -0700
+++ b/mercurial/revset.py	Thu Mar 13 14:51:04 2014 -0700
@@ -2353,8 +2353,9 @@
         return self._iter
 
     def __iter__(self):
-        for r in self._iterator():
-            yield r
+        if self._genlist:
+            return iter(self._genlist)
+        return iter(self._iterator())
 
     def __contains__(self, x):
         return x in self._r1 or x in self._r2