[PATCH] diffstat: fix fails on non-terminals (issue1547) and on only binary changes

Matt Mackall mpm at selenic.com
Tue Mar 17 14:08:40 CDT 2009


On Fri, 2009-03-13 at 18:20 +0200, Alexander Solovyov wrote:
> # HG changeset patch
> # User Alexander Solovyov <piranha at piranha.org.ua>
> # Date 1236799591 -7200
> # Node ID e0b2c850cc64646c66760c04bbff1f941b869073
> # Parent  a536b9a43227db025d0991c689ed844fe34e8279
> diffstat: fix fails on non-terminals (issue1547) and on only binary changes
> 
> This patch adds check agains terminal width guessing so it will return meaning
> value instead of failing.
> 
> Also it introduces optional width parameter for diffstat so width guess
> wouldn't be performed at all. It's usage is added to every non-interactive
> user of diffstat.
> 
> Additionally if you had only binary changes you get 0 total changes in
> your diffstat, which would cause ZeroDivisionError upon rendering.

This is a bit hairier than I'd like. A quick test with stock diffstat(1)
shows that it actually ignores terminal width. So I'm gonna go a
different route for 1.2.1: we're going to default to 80 columns like
standard diffstat does. Which is probably the right thing to do anyway.

-- 
http://selenic.com : development and support for Mercurial and Linux




More information about the Mercurial-devel mailing list