comparison hgext/churn.py @ 11311:fcd06ecd4cb7

Merge backout
author Steve Borho <steve@borho.org>
date Tue, 08 Jun 2010 15:52:56 -0500
parents ac873ecfc3c2
children 40c06bbf58be
comparison
equal deleted inserted replaced
11309:ef7636efeb01 11311:fcd06ecd4cb7
148 width = ttywidth - maxname - 2 - 2 - 2 148 width = ttywidth - maxname - 2 - 2 - 2
149 149
150 if opts.get('diffstat'): 150 if opts.get('diffstat'):
151 width -= 15 151 width -= 15
152 def format(name, (added, removed)): 152 def format(name, (added, removed)):
153 return "%s %15s %s%s\n" % (ui.label(pad(name, maxname), 153 return "%s %15s %s%s\n" % (pad(name, maxname),
154 'ui.plain'), 154 '+%d/-%d' % (added, removed),
155 ui.label('+%d/-%d' % (added, removed),
156 'ui.plain'),
157 ui.label('+' * charnum(added), 155 ui.label('+' * charnum(added),
158 'diffstat.inserted'), 156 'diffstat.inserted'),
159 ui.label('-' * charnum(removed), 157 ui.label('-' * charnum(removed),
160 'diffstat.deleted')) 158 'diffstat.deleted'))
161 else: 159 else:
162 width -= 6 160 width -= 6
163 def format(name, count): 161 def format(name, count):
164 return ui.label("%s %6d %s\n" % (pad(name, maxname), sum(count), 162 return "%s %6d %s\n" % (pad(name, maxname), sum(count),
165 '*' * charnum(sum(count))), 'ui.plain') 163 '*' * charnum(sum(count)))
166 164
167 def charnum(count): 165 def charnum(count):
168 return int(round(count * width / maxcount)) 166 return int(round(count * width / maxcount))
169 167
170 for name, count in rate: 168 for name, count in rate:
171 ui.write(format(name, count), label='ui.labeled') 169 ui.write(format(name, count))
172 170
173 171
174 cmdtable = { 172 cmdtable = {
175 "churn": 173 "churn":
176 (churn, 174 (churn,