changeset 22996:a43d929d1fa1

generatorset: implement __len__ It was the only smartset class without a `__len__` implementation.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 15 Oct 2014 04:28:55 -0700
parents 2587631c5f8a
children d16804069db1
files mercurial/revset.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Wed Oct 15 04:26:23 2014 -0700
+++ b/mercurial/revset.py	Wed Oct 15 04:28:55 2014 -0700
@@ -2776,6 +2776,11 @@
             self.fastasc = asc.__iter__
             self.fastdesc = asc.__reversed__
 
+    def __len__(self):
+        for x in self._consumegen():
+            pass
+        return len(self._genlist)
+
     def sort(self, reverse=False):
         self._ascending = not reverse