Mercurial > hg-stable
changeset 6223:bab6c8f2bb1a
churn: show comitter email addresses unclipped (bug 1023)
Email addresses were being clipped at a hard-coded 20 chars. Measure
the length of all email addresses and accommodate the longest.
author | Stephen Deasey <sdeasey@gmail.com> |
---|---|
date | Sun, 09 Mar 2008 17:34:55 +0000 |
parents | d2353ed8b153 |
children | 210ee6204a29 595a69a01129 |
files | contrib/churn.py |
diffstat | 1 files changed, 13 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/churn.py Sat Mar 08 17:28:25 2008 -0800 +++ b/contrib/churn.py Sun Mar 09 17:34:55 2008 +0000 @@ -178,21 +178,23 @@ # make a list of tuples (name, lines) and sort it in descending order ordered = stats.items() - ordered.sort(lambda x, y: cmp(y[1], x[1])) - if not ordered: return - maximum = ordered[0][1] + ordered.sort(lambda x, y: cmp(y[1], x[1])) + max_churn = ordered[0][1] - width = get_tty_width() - ui.note(_("assuming %i character terminal\n") % width) - width -= 1 + tty_width = get_tty_width() + ui.note(_("assuming %i character terminal\n") % tty_width) + tty_width -= 1 - for i in ordered: - person = i[0] - lines = i[1] - print "%s %6d %s" % (pad(person, 20), lines, - graph(lines, maximum, width - 20 - 1 - 6 - 2 - 2, '*')) + max_user_width = max([len(user) for user, churn in ordered]) + + graph_width = tty_width - max_user_width - 1 - 6 - 2 - 2 + + for user, churn in ordered: + print "%s %6d %s" % (pad(user, max_user_width), + churn, + graph(churn, max_churn, graph_width, '*')) cmdtable = { "churn":