hgext/churn.py
changeset 7076 c29d3f4ed967
parent 7070 2627ef59195d
child 7127 9df67ee30ef5
equal deleted inserted replaced
7075:6db6f6db026a 7076:c29d3f4ed967
   151 
   151 
   152     rate = countrate(ui, repo, amap, *pats, **opts).items()
   152     rate = countrate(ui, repo, amap, *pats, **opts).items()
   153     if not rate:
   153     if not rate:
   154         return
   154         return
   155 
   155 
   156     keyfn = (not opts.get('sort')) and (lambda (k,v): (v,k)) or None
   156     sortfn = ((not opts.get('sort')) and (lambda a, b: cmp(b[1], a[1])) or None)
   157     rate.sort(key=keyfn, reverse=not opts.get('sort'))
   157     rate.sort(sortfn)
   158 
   158 
   159     maxcount = float(max(v for k, v in rate))
   159     maxcount = float(max([v for k, v in rate]))
   160     maxname = max(len(k) for k, v in rate)
   160     maxname = max([len(k) for k, v in rate])
   161 
   161 
   162     ttywidth = get_tty_width()
   162     ttywidth = get_tty_width()
   163     ui.debug(_("assuming %i character terminal\n") % ttywidth)
   163     ui.debug(_("assuming %i character terminal\n") % ttywidth)
   164     width = ttywidth - maxname - 2 - 6 - 2 - 2
   164     width = ttywidth - maxname - 2 - 6 - 2 - 2
   165 
   165