# HG changeset patch # User Pierre-Yves David # Date 2014-10-15 11:26:23 # Node ID 2587631c5f8a15492fb6a41b232405e84496a2cc # Parent 840be5ca03e1db16ba994e55597771c418166c97 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. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2255,6 +2255,12 @@ class abstractsmartset(object): 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()