Mercurial > hg
comparison hgext/churn.py @ 3041:45942bb49194
[churn] Cleanup suggestions from tonfa
Use demandload
Be smarter about the final list creation
author | Josef "Jeff" Sipek <jeffpc@josefsipek.net> |
---|---|
date | Tue, 08 Aug 2006 15:29:33 -0400 |
parents | f74077473b36 |
children | 2d35d7c6f251 |
comparison
equal
deleted
inserted
replaced
3040:f74077473b36 | 3041:45942bb49194 |
---|---|
9 # Aliases map file format is simple one alias per line in the following | 9 # Aliases map file format is simple one alias per line in the following |
10 # format: | 10 # format: |
11 # | 11 # |
12 # <alias email> <actual email> | 12 # <alias email> <actual email> |
13 | 13 |
14 import time, sys, signal, os | 14 from mercurial.demandload import * |
15 from mercurial import hg, mdiff, fancyopts, commands, ui, util, templater | 15 demandload(globals(), 'time sys signal os') |
16 demandload(globals(), 'mercurial:hg,mdiff,fancyopts,commands,ui,util,templater') | |
16 | 17 |
17 def __gather(ui, repo, node1, node2): | 18 def __gather(ui, repo, node1, node2): |
18 def dirtywork(f, mmap1, mmap2): | 19 def dirtywork(f, mmap1, mmap2): |
19 lines = 0 | 20 lines = 0 |
20 | 21 |
128 return | 129 return |
129 | 130 |
130 amap = get_aliases(f) | 131 amap = get_aliases(f) |
131 f.close() | 132 f.close() |
132 | 133 |
133 os.chdir(repo.root) | |
134 stats = gather_stats(ui, repo, amap) | 134 stats = gather_stats(ui, repo, amap) |
135 | 135 |
136 # make a list of tuples (name, lines) and sort it in descending order | 136 # make a list of tuples (name, lines) and sort it in descending order |
137 ordered = stats.items() | 137 ordered = stats.items() |
138 ordered.sort(cmp=lambda x,y:cmp(x[1], y[1])) | 138 ordered.sort(cmp=lambda x,y:cmp(y[1], x[1])) |
139 ordered.reverse() | |
140 | 139 |
141 maximum = ordered[0][1] | 140 maximum = ordered[0][1] |
142 | 141 |
143 ui.note("Assuming 80 character terminal\n") | 142 ui.note("Assuming 80 character terminal\n") |
144 width = 80 - 1 | 143 width = 80 - 1 |