churn: py2.3 compatibility fix
- generator expressions appeared in py2.4
- sort doesn't have any arguments except sorting function
--- 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)