Mercurial > hg
comparison hgext/churn.py @ 9388:f7968bba2307
churn: issue833 was reintroduced in 9bc46d069a76, correct it and add a test
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Mon, 24 Aug 2009 12:47:44 +0200 |
parents | 9dda4c73fc3b |
children | 7cca980317c5 dbe2bdd5e488 |
comparison
equal
deleted
inserted
replaced
9384:d91078a2652f | 9388:f7968bba2307 |
---|---|
144 return | 144 return |
145 | 145 |
146 sortfn = ((not opts.get('sort')) and (lambda a, b: cmp(b[1], a[1])) or None) | 146 sortfn = ((not opts.get('sort')) and (lambda a, b: cmp(b[1], a[1])) or None) |
147 rate.sort(sortfn) | 147 rate.sort(sortfn) |
148 | 148 |
149 maxcount = float(max([v for k, v in rate])) | 149 # Be careful not to have a zero maxcount (issue833) |
150 maxcount = float(max([v for k, v in rate])) or 1.0 | |
150 maxname = max([len(k) for k, v in rate]) | 151 maxname = max([len(k) for k, v in rate]) |
151 | 152 |
152 ttywidth = util.termwidth() | 153 ttywidth = util.termwidth() |
153 ui.debug(_("assuming %i character terminal\n") % ttywidth) | 154 ui.debug(_("assuming %i character terminal\n") % ttywidth) |
154 width = ttywidth - maxname - 2 - 6 - 2 - 2 | 155 width = ttywidth - maxname - 2 - 6 - 2 - 2 |