From patchwork Tue Sep 16 15:59:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1, of, 2] formatter: correct bool testing which should be __nonzero__ in Python 2 From: Yuya Nishihara X-Patchwork-Id: 5829 Message-Id: <41ce9361751ce40497dc.1410883166@mimosa> To: mercurial-devel@selenic.com Date: Wed, 17 Sep 2014 00:59:26 +0900 # HG changeset patch # User Yuya Nishihara # Date 1410881463 -32400 # Wed Sep 17 00:31:03 2014 +0900 # Node ID 41ce9361751ce40497dcbf29ec2d84ef0fbc7593 # Parent eaeee6f95fc07ed22acd3e62db4d241d0ee97b84 formatter: correct bool testing which should be __nonzero__ in Python 2 diff --git a/mercurial/formatter.py b/mercurial/formatter.py --- a/mercurial/formatter.py +++ b/mercurial/formatter.py @@ -16,7 +16,7 @@ class baseformatter(object): self._style = opts.get("style") self._template = opts.get("template") self._item = None - def __bool__(self): + def __nonzero__(self): '''return False if we're not doing real templating so we can skip extra work''' return True @@ -51,7 +51,7 @@ class plainformatter(baseformatter): '''the default text output scheme''' def __init__(self, ui, topic, opts): baseformatter.__init__(self, ui, topic, opts) - def __bool__(self): + def __nonzero__(self): return False def startitem(self): pass