Mercurial > hg
changeset 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 | 30853f4bde2f |
children | d5422faf648c |
files | hgext/keyword.py |
diffstat | 1 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/keyword.py Fri Jun 22 12:17:49 2012 +0200 +++ b/hgext/keyword.py Thu Jun 28 15:06:41 2012 +0100 @@ -505,11 +505,18 @@ showfiles += ([f for f in files if f not in kwfiles], [f for f in unknown if f not in kwunknown]) kwlabels = 'enabled deleted enabledunknown ignored ignoredunknown'.split() - kwstates = zip('K!kIi', showfiles, kwlabels) - for char, filenames, kwstate in kwstates: - fmt = (opts.get('all') or ui.verbose) and '%s %%s\n' % char or '%s\n' + kwstates = zip(kwlabels, 'K!kIi', showfiles) + fm = ui.formatter('kwfiles', opts) + fmt = '%.0s%s\n' + if opts.get('all') or ui.verbose: + fmt = '%s %s\n' + for kwstate, char, filenames in kwstates: + label = 'kwfiles.' + kwstate for f in filenames: - ui.write(fmt % repo.pathto(f, cwd), label='kwfiles.' + kwstate) + fm.startitem() + fm.write('kwstatus path', fmt, char, + repo.pathto(f, cwd), label=label) + fm.end() @command('kwshrink', commands.walkopts, _('hg kwshrink [OPTION]... [FILE]...')) def shrink(ui, repo, *pats, **opts):