obsstore: add a __len__ method
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 25 Feb 2014 10:32:54 -0800
changeset 20585 f3c8db3d6d66
parent 20584 224a058f7cd1
child 20586 2d52f37937b0
obsstore: add a __len__ method We can already use "for mark in store:" it make sense to allow "len(store)" too.
mercurial/obsolete.py
--- a/mercurial/obsolete.py	Tue Feb 25 10:21:54 2014 -0800
+++ b/mercurial/obsolete.py	Tue Feb 25 10:32:54 2014 -0800
@@ -247,6 +247,9 @@
     def __iter__(self):
         return iter(self._all)
 
+    def __len__(self):
+        return len(self._all)
+
     def __nonzero__(self):
         return bool(self._all)