Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 22494:14f6cebfcb8a
revset: document the choice made in __generatorset.__iter__
The method code looks a bit ugly but has good reasons to. We document them
to prevent naive refactoring in the future.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 16 Sep 2014 23:42:41 -0700 |
parents | e40bb83d0989 |
children | 668b26d32bf6 |
comparison
equal
deleted
inserted
replaced
22491:5e16fe6fdd32 | 22494:14f6cebfcb8a |
---|---|
2646 if self._finished: | 2646 if self._finished: |
2647 for x in self._genlist: | 2647 for x in self._genlist: |
2648 yield x | 2648 yield x |
2649 return | 2649 return |
2650 | 2650 |
2651 # We have to use this complex iteration strategy to allow multiple | |
2652 # iterations at the same time. We need to be able to catch revision | |
2653 # removed from `consumegen` and added to genlist in another instance. | |
2654 # | |
2655 # Getting rid of it would provide an about 15% speed up on this | |
2656 # iteration. | |
2651 i = 0 | 2657 i = 0 |
2652 genlist = self._genlist | 2658 genlist = self._genlist |
2653 consume = self._consumegen() | 2659 consume = self._consumegen() |
2654 while True: | 2660 while True: |
2655 if i < len(genlist): | 2661 if i < len(genlist): |