changeset 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
files hgext/churn.py
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/churn.py	Wed Jul 26 19:42:56 2006 -0400
+++ b/hgext/churn.py	Tue Aug 08 15:29:33 2006 -0400
@@ -11,8 +11,9 @@
 #
 # <alias email> <actual email>
 
-import time, sys, signal, os
-from mercurial import hg, mdiff, fancyopts, commands, ui, util, templater
+from mercurial.demandload import *
+demandload(globals(), 'time sys signal os')
+demandload(globals(), 'mercurial:hg,mdiff,fancyopts,commands,ui,util,templater')
 
 def __gather(ui, repo, node1, node2):
     def dirtywork(f, mmap1, mmap2):
@@ -130,13 +131,11 @@
         amap = get_aliases(f)
         f.close()
     
-    os.chdir(repo.root)
     stats = gather_stats(ui, repo, amap)
 
     # make a list of tuples (name, lines) and sort it in descending order
     ordered = stats.items()
-    ordered.sort(cmp=lambda x,y:cmp(x[1], y[1]))
-    ordered.reverse()
+    ordered.sort(cmp=lambda x,y:cmp(y[1], x[1]))
 
     maximum = ordered[0][1]