revset: make __len__ part of the offical API
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 15 Oct 2014 04:26:23 -0700
changeset 22995 2587631c5f8a
parent 22994 840be5ca03e1
child 22996 a43d929d1fa1
revset: make __len__ part of the offical API It is common for code to ask for the length of a revset. In fact, all but generatorset already implement it.
mercurial/revset.py
--- a/mercurial/revset.py	Sat Oct 04 16:46:50 2014 +0900
+++ b/mercurial/revset.py	Wed Oct 15 04:26:23 2014 -0700
@@ -2255,6 +2255,12 @@
         Return None if the set is empty"""
         raise NotImplementedError()
 
+    def __len__(self):
+        """return the length of the smartsets
+
+        This can be expensive on smartset that could be lazy otherwise."""
+        raise NotImplementedError()
+
     def reverse(self):
         """reverse the expected iteration order"""
         raise NotImplementedError()