Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revset.py @ 20706:efb34b066e7a
revset: made ascgeneratorset a private class
This class is 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:18:54 -0700 |
parents | 9cc2249a9461 |
children | 1d5d6f622b94 |
comparison
equal
deleted
inserted
replaced
20705:9cc2249a9461 | 20706:efb34b066e7a |
---|---|
68 if x != nullrev and x in seen: | 68 if x != nullrev and x in seen: |
69 seen.add(i) | 69 seen.add(i) |
70 yield i | 70 yield i |
71 break | 71 break |
72 | 72 |
73 return ascgeneratorset(iterate()) | 73 return _ascgeneratorset(iterate()) |
74 | 74 |
75 def _revsbetween(repo, roots, heads): | 75 def _revsbetween(repo, roots, heads): |
76 """Return all paths between roots and heads, inclusive of both endpoint | 76 """Return all paths between roots and heads, inclusive of both endpoint |
77 sets.""" | 77 sets.""" |
78 if not roots: | 78 if not roots: |
2389 if not self._finished: | 2389 if not self._finished: |
2390 for i in self: | 2390 for i in self: |
2391 continue | 2391 continue |
2392 self._genlist.sort(reverse=reverse) | 2392 self._genlist.sort(reverse=reverse) |
2393 | 2393 |
2394 class ascgeneratorset(_generatorset): | 2394 class _ascgeneratorset(_generatorset): |
2395 """ Same structure as _generatorset but stops iterating after it goes past | 2395 """Wrap a generator of ascending elements for lazy iteration |
2396 | |
2397 Same structure as _generatorset but stops iterating after it goes past | |
2396 the value when asked for membership and the element is not contained | 2398 the value when asked for membership and the element is not contained |
2399 | |
2400 This class does not duck-type baseset and it's only supposed to be used | |
2401 internally | |
2397 """ | 2402 """ |
2398 def __contains__(self, x): | 2403 def __contains__(self, x): |
2399 if x in self._cache: | 2404 if x in self._cache: |
2400 return self._cache[x] | 2405 return self._cache[x] |
2401 | 2406 |