1. Benoît Allard
  2. hotfiles
Issue #1 open

make the number of displayed files configurable

Simon H.
created an issue
  • The default could stay on 10
  • being able to enter a range would be nice (example: file with ranks 11 to 20)
  • entering a number in % would be nice (example: show hottest 10% of file; 10% is the value mentioned in the blog post)

Comments (4)

  1. Simon H. reporter
    # HG changeset patch
    # User simohe@besonet.ch
    # Date 1331896050 -3600
    # Node ID 66740284af8442ef6228ed9debe5d25bda6bef32
    # Parent  7317174fef67772ed6799791a1bab803d39831b5
    Add argument for number of hot files to show
    
    only number of files, no range and no % of total files
    
    diff -r 7317174fef67 -r 66740284af84 hotfiles.py
    --- a/hotfiles.py	Fri Mar 16 11:51:36 2012 +0100
    +++ b/hotfiles.py	Fri Mar 16 12:07:30 2012 +0100
    @@ -53,7 +53,8 @@
     @command('hotfiles',
              [('r', 'rev', '', _('operate up to a given revision'), 'REV'),
               ('p', 'pattern', '', _('pattern to filter issue-fixing commits'),
    -           'REGEX')
    +           'REGEX'),
    +          ('n', 'nfiles', 10, _('number of files to show'), 'NUM'),
               ] + commands.walkopts,
              _('[-r REV] [-p REGEX]')
     )
    @@ -83,6 +84,8 @@
     
         b = getb()
     
    +    endlist = opts.get('nfiles', 10)
    +
         excludeglob = ui.configlist('hotfiles', 'exclude.glob', [])
         excludeglob.extend(opts.get('exclude', []))
         if b is not None:
    @@ -148,7 +151,7 @@
             pos += 1
         ui.progress('score', None)
     
    -    d = sorted(d, key=lambda x: x[1], reverse=True)[:10]
    +    d = sorted(d, key=lambda x: x[1], reverse=True)[:endlist]
     
         if d:
             max = d[0][1]
    
  2. Benoît Allard repo owner
    • changed status to open

    Looks good, I took it and renamed your argument nfiles all the way.

    What about the '%' support ? and the range one ? Are you still working on them ?

  3. Log in to comment