changeset 22995:2587631c5f8a

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.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 15 Oct 2014 04:26:23 -0700
parents 840be5ca03e1
children a43d929d1fa1
files mercurial/revset.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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()