# HG changeset patch # User Anton Shestakov # Date 1557302274 -28800 # Node ID 55c347b4874facd765bb00f469e735764048717a # Parent 7c05b16259211cd1ef23683cbb4e214ad0ae516d stack: implement __bool__ and __nonzero__ diff -r 7c05b1625921 -r 55c347b4874f hgext3rd/topic/stack.py --- a/hgext3rd/topic/stack.py Sun May 05 17:39:46 2019 +0800 +++ b/hgext3rd/topic/stack.py Wed May 08 15:57:54 2019 +0800 @@ -77,6 +77,11 @@ def __getitem__(self, index): return self.revs[index] + def __nonzero__(self): + return bool(self._revs) + + __bool__ = __nonzero__ + def index(self, item): return self.revs.index(item)