[PATCH 2 of 3] formatter: add specific check for plain formatting

Yuya Nishihara yuya at tcha.org
Tue Aug 30 10:11:39 EDT 2016


On Mon, 29 Aug 2016 12:52:42 -0500, Mathias De Maré wrote:
> # HG changeset patch
> # User Mathias De Maré <mathias.demare at gmail.com>
> # Date 1472483949 -7200
> #      Mon Aug 29 17:19:09 2016 +0200
> # Node ID e348c87b33d73a590bee53b74def915b1ce8c6fe
> # Parent  fb88d0c87c2746bd84983f1005ed83276c6e9c68
> formatter: add specific check for plain formatting
> 
> diff --git a/mercurial/formatter.py b/mercurial/formatter.py
> --- a/mercurial/formatter.py
> +++ b/mercurial/formatter.py
> @@ -91,6 +91,9 @@
>      def plain(self, text, **opts):
>          '''show raw text for non-templated mode'''
>          pass
> +    def isplain(self):
> +        '''check for plain formatter usage'''
> +        return False

I like this, but there's bool(fm), which equals to "not fm.isplain()". Can
you replace all fm.__nonzero__() calls by fm.isplain() ?


More information about the Mercurial-devel mailing list