hgext/churn.py
changeset 9562 812aaef40757
parent 9557 dbe2bdd5e488
parent 9390 637f2726ec7f
child 9569 ceb0f59e1327
equal deleted inserted replaced
9561:2388ba07449b 9562:812aaef40757
    51     rate = {}
    51     rate = {}
    52     df = False
    52     df = False
    53     if opts.get('date'):
    53     if opts.get('date'):
    54         df = util.matchdate(opts['date'])
    54         df = util.matchdate(opts['date'])
    55 
    55 
    56     get = util.cachefunc(lambda r: repo[r].changeset())
    56     get = util.cachefunc(lambda r: repo[r])
    57     changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts)
    57     changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts)
    58     for st, rev, fns in changeiter:
    58     for st, rev, fns in changeiter:
       
    59 
    59         if not st == 'add':
    60         if not st == 'add':
    60             continue
    61             continue
    61         if df and not df(get(rev)[2][0]): # doesn't match date format
    62 
       
    63         ctx = get(rev)
       
    64         if df and not df(ctx.date()[0]): # doesn't match date format
    62             continue
    65             continue
    63 
    66 
    64         ctx = repo[rev]
       
    65         key = getkey(ctx)
    67         key = getkey(ctx)
    66         key = amap.get(key, key) # alias remap
    68         key = amap.get(key, key) # alias remap
    67         if opts.get('changesets'):
    69         if opts.get('changesets'):
    68             rate[key] = rate.get(key, 0) + 1
    70             rate[key] = rate.get(key, 0) + 1
    69         else:
    71         else:
   145 
   147 
   146     sortkey = ((not opts.get('sort')) and (lambda x: -x[1]) or None)
   148     sortkey = ((not opts.get('sort')) and (lambda x: -x[1]) or None)
   147     rate.sort(key=sortkey)
   149     rate.sort(key=sortkey)
   148 
   150 
   149     # Be careful not to have a zero maxcount (issue833)
   151     # Be careful not to have a zero maxcount (issue833)
   150     maxcount = float(max([v for k, v in rate])) or 1.0
   152     maxcount = float(max(v for k, v in rate)) or 1.0
   151     maxname = max([len(k) for k, v in rate])
   153     maxname = max(len(k) for k, v in rate)
   152 
   154 
   153     ttywidth = util.termwidth()
   155     ttywidth = util.termwidth()
   154     ui.debug(_("assuming %i character terminal\n") % ttywidth)
   156     ui.debug(_("assuming %i character terminal\n") % ttywidth)
   155     width = ttywidth - maxname - 2 - 6 - 2 - 2
   157     width = ttywidth - maxname - 2 - 6 - 2 - 2
   156 
   158