changeset 7076:c29d3f4ed967

churn: py2.3 compatibility fix - generator expressions appeared in py2.4 - sort doesn't have any arguments except sorting function
author Alexander Solovyov <piranha@piranha.org.ua>
date Fri, 10 Oct 2008 15:53:49 +0300
parents 6db6f6db026a
children ccbd39cad3c3
files hgext/churn.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/churn.py	Fri Oct 10 13:20:40 2008 +0200
+++ b/hgext/churn.py	Fri Oct 10 15:53:49 2008 +0300
@@ -153,11 +153,11 @@
     if not rate:
         return
 
-    keyfn = (not opts.get('sort')) and (lambda (k,v): (v,k)) or None
-    rate.sort(key=keyfn, reverse=not opts.get('sort'))
+    sortfn = ((not opts.get('sort')) and (lambda a, b: cmp(b[1], a[1])) or None)
+    rate.sort(sortfn)
 
-    maxcount = float(max(v for k, v in rate))
-    maxname = max(len(k) for k, v in rate)
+    maxcount = float(max([v for k, v in rate]))
+    maxname = max([len(k) for k, v in rate])
 
     ttywidth = get_tty_width()
     ui.debug(_("assuming %i character terminal\n") % ttywidth)