[PATCH 1 of 2] formatter: introduce isplain() to replace (the inverse of) __nonzero__()
Yuya Nishihara
yuya at tcha.org
Tue Sep 20 13:06:22 UTC 2016
On Mon, 19 Sep 2016 09:14:41 -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 084ca55ce77a5fe77bc93db26346cc71211a0070
> # Parent 285a8c3e53f2183438f0cdbc238e4ab851d0d110
> formatter: introduce isplain() to replace (the inverse of) __nonzero__()
You have one more "if fm:". Fixed as follows and queued this, thanks. Also
flagged as (API).
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4442,10 +4442,10 @@ def grep(ui, repo, pattern, *pats, **opt
def display(fm, fn, ctx, pstates, states):
rev = ctx.rev()
- if fm:
+ if fm.isplain():
+ formatuser = ui.shortuser
+ else:
formatuser = str
- else:
- formatuser = ui.shortuser
if ui.quiet:
datefmt = '%Y-%m-%d'
else:
diff --git a/mercurial/formatter.py b/mercurial/formatter.py
--- a/mercurial/formatter.py
+++ b/mercurial/formatter.py
@@ -141,8 +141,6 @@ class plainformatter(baseformatter):
self.hexfunc = hex
else:
self.hexfunc = short
- def __nonzero__(self):
- return False
def startitem(self):
pass
def data(self, **data):
More information about the Mercurial-devel
mailing list