Mercurial > hg-stable
changeset 20705:9cc2249a9461
revset: made generatorset a private class
This class are not supposed to be used outside revset.py since it only
wraps content that is used by baseset typed classes.
It only gets created by revset operations or private methods.
author | Lucas Moscovicz <lmoscovicz@fb.com> |
---|---|
date | Wed, 12 Mar 2014 17:07:38 -0700 |
parents | 623ed0ed793e |
children | efb34b066e7a |
files | mercurial/revset.py |
diffstat | 1 files changed, 12 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revset.py Wed Mar 05 18:49:47 2014 -0800 +++ b/mercurial/revset.py Wed Mar 12 17:07:38 2014 -0700 @@ -2325,7 +2325,7 @@ for r in self._r2: if r not in s: yield r - self._iter = generatorset(gen()) + self._iter = _generatorset(gen()) return self._iter @@ -2336,11 +2336,16 @@ def __contains__(self, x): return x in self._r1 or x in self._r2 -class generatorset(object): - """Wrapper structure for generators that provides lazy membership and can +class _generatorset(object): + """Wrap a generator for lazy iteration + + Wrapper structure for generators that provides lazy membership and can be iterated more than once. When asked for membership it generates values until either it finds the requested one or has gone through all the elements in the generator + + This class does not duck-type baseset and it's only supposed to be used + internally """ def __init__(self, gen): self._gen = gen @@ -2386,8 +2391,8 @@ continue self._genlist.sort(reverse=reverse) -class ascgeneratorset(generatorset): - """ Same structure as generatorset but stops iterating after it goes past +class ascgeneratorset(_generatorset): + """ Same structure as _generatorset but stops iterating after it goes past the value when asked for membership and the element is not contained """ def __contains__(self, x): @@ -2403,8 +2408,8 @@ self._cache[x] = False return False -class descgeneratorset(generatorset): - """ Same structure as generatorset but stops iterating after it goes past +class descgeneratorset(_generatorset): + """ Same structure as _generatorset but stops iterating after it goes past the value when asked for membership and the element is not contained """ def __contains__(self, x):