Show More
@@ -766,6 +766,11 b' class generatorset(abstractsmartset):' | |||||
766 | be iterated more than once. |
|
766 | be iterated more than once. | |
767 | When asked for membership it generates values until either it finds the |
|
767 | When asked for membership it generates values until either it finds the | |
768 | requested one or has gone through all the elements in the generator |
|
768 | requested one or has gone through all the elements in the generator | |
|
769 | ||||
|
770 | >>> xs = generatorset([0, 1, 4], iterasc=True) | |||
|
771 | >>> assert xs.last() == xs.last() | |||
|
772 | >>> xs.last() # cached | |||
|
773 | 4 | |||
769 | """ |
|
774 | """ | |
770 | def __init__(self, gen, iterasc=None): |
|
775 | def __init__(self, gen, iterasc=None): | |
771 | """ |
|
776 | """ | |
@@ -937,7 +942,7 b' class generatorset(abstractsmartset):' | |||||
937 | # we need to consume all and try again |
|
942 | # we need to consume all and try again | |
938 | for x in self._consumegen(): |
|
943 | for x in self._consumegen(): | |
939 | pass |
|
944 | pass | |
940 |
return self. |
|
945 | return self.last() | |
941 | return next(it(), None) |
|
946 | return next(it(), None) | |
942 |
|
947 | |||
943 | def __repr__(self): |
|
948 | def __repr__(self): |
@@ -1337,6 +1337,16 b' Test order of first/last revisions' | |||||
1337 | 0 |
|
1337 | 0 | |
1338 | 1 |
|
1338 | 1 | |
1339 |
|
1339 | |||
|
1340 | Test scmutil.revsingle() should return the last revision | |||
|
1341 | ||||
|
1342 | $ hg debugrevspec -s 'last(0::)' | |||
|
1343 | * set: | |||
|
1344 | <baseset slice=0:1 | |||
|
1345 | <generatorset->> | |||
|
1346 | 9 | |||
|
1347 | $ hg identify -r '0::' --num | |||
|
1348 | 9 | |||
|
1349 | ||||
1340 | Test matching |
|
1350 | Test matching | |
1341 |
|
1351 | |||
1342 | $ log 'matching(6)' |
|
1352 | $ log 'matching(6)' |
General Comments 0
You need to be logged in to leave comments.
Login now