hgext/churn.py
changeset 3041 45942bb49194
parent 3040 f74077473b36
child 3042 2d35d7c6f251
--- 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]