addset: drop caching through generatorset
authorPierre-Yves David <pierre-yves.david@fb.com>
Fri, 03 Oct 2014 20:23:02 -0700
changeset 22799 bafa371d7af3
parent 22798 586d7058ea48
child 22800 29a8c20e14a8
addset: drop caching through generatorset The utility of this cache is debatable (no visible benchmark impact) and using generatorset for such purpose makes the code complicated. We drop it for now. Someone can reintroduce a smart version of it in the future if it is detected to be relevant.
mercurial/revset.py
--- a/mercurial/revset.py	Fri Oct 03 21:01:30 2014 -0700
+++ b/mercurial/revset.py	Fri Oct 03 20:23:02 2014 -0700
@@ -2499,22 +2499,20 @@
         If the ascending attribute is set, iterate over both collections at the
         same time, yielding only one value at a time in the given order.
         """
-        if not self._iter:
-            if self._ascending is None:
-                def gen():
-                    for r in self._r1:
+        if self._ascending is None:
+            def gen():
+                for r in self._r1:
+                    yield r
+                s = self._r1.set()
+                for r in self._r2:
+                    if r not in s:
                         yield r
-                    s = self._r1.set()
-                    for r in self._r2:
-                        if r not in s:
-                            yield r
-                gen = gen()
-            else:
-                iter1 = iter(self._r1)
-                iter2 = iter(self._r2)
-                gen = self._iterordered(self._ascending, iter1, iter2)
-            self._iter = generatorset(gen)
-        return self._iter
+            gen = gen()
+        else:
+            iter1 = iter(self._r1)
+            iter2 = iter(self._r2)
+            gen = self._iterordered(self._ascending, iter1, iter2)
+        return gen
 
     def __iter__(self):
         if self._genlist: