Mercurial > hg
comparison hgext/keyword.py @ 17057:9720c55d605b
keyword: use ui.formatter for kwfiles output
author | Christian Ebert <blacktrash@gmx.net> |
---|---|
date | Thu, 28 Jun 2012 15:06:41 +0100 |
parents | d3b807e673a8 |
children | e7cfe3587ea4 |
comparison
equal
deleted
inserted
replaced
17056:30853f4bde2f | 17057:9720c55d605b |
---|---|
503 showfiles = [], [], [] | 503 showfiles = [], [], [] |
504 if opts.get('all') or opts.get('ignore'): | 504 if opts.get('all') or opts.get('ignore'): |
505 showfiles += ([f for f in files if f not in kwfiles], | 505 showfiles += ([f for f in files if f not in kwfiles], |
506 [f for f in unknown if f not in kwunknown]) | 506 [f for f in unknown if f not in kwunknown]) |
507 kwlabels = 'enabled deleted enabledunknown ignored ignoredunknown'.split() | 507 kwlabels = 'enabled deleted enabledunknown ignored ignoredunknown'.split() |
508 kwstates = zip('K!kIi', showfiles, kwlabels) | 508 kwstates = zip(kwlabels, 'K!kIi', showfiles) |
509 for char, filenames, kwstate in kwstates: | 509 fm = ui.formatter('kwfiles', opts) |
510 fmt = (opts.get('all') or ui.verbose) and '%s %%s\n' % char or '%s\n' | 510 fmt = '%.0s%s\n' |
511 if opts.get('all') or ui.verbose: | |
512 fmt = '%s %s\n' | |
513 for kwstate, char, filenames in kwstates: | |
514 label = 'kwfiles.' + kwstate | |
511 for f in filenames: | 515 for f in filenames: |
512 ui.write(fmt % repo.pathto(f, cwd), label='kwfiles.' + kwstate) | 516 fm.startitem() |
517 fm.write('kwstatus path', fmt, char, | |
518 repo.pathto(f, cwd), label=label) | |
519 fm.end() | |
513 | 520 |
514 @command('kwshrink', commands.walkopts, _('hg kwshrink [OPTION]... [FILE]...')) | 521 @command('kwshrink', commands.walkopts, _('hg kwshrink [OPTION]... [FILE]...')) |
515 def shrink(ui, repo, *pats, **opts): | 522 def shrink(ui, repo, *pats, **opts): |
516 '''revert expanded keywords in the working directory | 523 '''revert expanded keywords in the working directory |
517 | 524 |