# HG changeset patch # User Matt Mackall # Date 1352244649 21600 # Node ID 8a8d1a2fd19d0c2d44e97c47790b4aaf3a708d8d # Parent c8709ff57ff2c0852ce2e781f7800663fc22d825 manifest: add formatter support diff -r c8709ff57ff2 -r 8a8d1a2fd19d mercurial/commands.py --- a/mercurial/commands.py Tue Nov 06 17:30:47 2012 -0600 +++ b/mercurial/commands.py Tue Nov 06 17:30:49 2012 -0600 @@ -4206,6 +4206,9 @@ Returns 0 on success. """ + + fm = ui.formatter('manifest', opts) + if opts.get('all'): if rev or node: raise util.Abort(_("can't specify a revision with --all")) @@ -4223,7 +4226,9 @@ finally: lock.release() for f in res: - ui.write("%s\n" % f) + fm.startitem() + fm.write("path", '%s\n', f) + fm.end() return if rev and node: @@ -4232,14 +4237,17 @@ if not node: node = rev - decor = {'l':'644 @ ', 'x':'755 * ', '':'644 '} + char = {'l': '@', 'x': '*', '': ''} + mode = {'l': '644', 'x': '755', '': '644'} ctx = scmutil.revsingle(repo, node) + mf = ctx.manifest() for f in ctx: - if ui.debugflag: - ui.write("%40s " % hex(ctx.manifest()[f])) - if ui.verbose: - ui.write(decor[ctx.flags(f)]) - ui.write("%s\n" % f) + fm.startitem() + fl = ctx[f].flags() + fm.condwrite(ui.debugflag, 'hash', '%s ', hex(mf[f])) + fm.condwrite(ui.verbose, 'mode type', '%s %1s ', mode[fl], char[fl]) + fm.write('path', '%s\n', f) + fm.end() @command('^merge', [('f', 'force', None, _('force a merge with outstanding changes')),