Show More
@@ -178,21 +178,23 b' def churn(ui, repo, **opts):' | |||||
178 |
|
178 | |||
179 | # make a list of tuples (name, lines) and sort it in descending order |
|
179 | # make a list of tuples (name, lines) and sort it in descending order | |
180 | ordered = stats.items() |
|
180 | ordered = stats.items() | |
181 | ordered.sort(lambda x, y: cmp(y[1], x[1])) |
|
|||
182 |
|
||||
183 | if not ordered: |
|
181 | if not ordered: | |
184 | return |
|
182 | return | |
185 | maximum = ordered[0][1] |
|
183 | ordered.sort(lambda x, y: cmp(y[1], x[1])) | |
|
184 | max_churn = ordered[0][1] | |||
186 |
|
185 | |||
187 | width = get_tty_width() |
|
186 | tty_width = get_tty_width() | |
188 | ui.note(_("assuming %i character terminal\n") % width) |
|
187 | ui.note(_("assuming %i character terminal\n") % tty_width) | |
189 | width -= 1 |
|
188 | tty_width -= 1 | |
190 |
|
189 | |||
191 | for i in ordered: |
|
190 | max_user_width = max([len(user) for user, churn in ordered]) | |
192 | person = i[0] |
|
191 | ||
193 | lines = i[1] |
|
192 | graph_width = tty_width - max_user_width - 1 - 6 - 2 - 2 | |
194 | print "%s %6d %s" % (pad(person, 20), lines, |
|
193 | ||
195 | graph(lines, maximum, width - 20 - 1 - 6 - 2 - 2, '*')) |
|
194 | for user, churn in ordered: | |
|
195 | print "%s %6d %s" % (pad(user, max_user_width), | |||
|
196 | churn, | |||
|
197 | graph(churn, max_churn, graph_width, '*')) | |||
196 |
|
198 | |||
197 | cmdtable = { |
|
199 | cmdtable = { | |
198 | "churn": |
|
200 | "churn": |
General Comments 0
You need to be logged in to leave comments.
Login now