From patchwork Tue Jul 3 13:26:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4, of, 8] files: automatically populate fields referenced from template From: Yuya Nishihara X-Patchwork-Id: 32583 Message-Id: <9afe500ac808e74f2d15.1530624367@mimosa> To: mercurial-devel@mercurial-scm.org Date: Tue, 03 Jul 2018 22:26:07 +0900 # HG changeset patch # User Yuya Nishihara # Date 1530449737 -32400 # Sun Jul 01 21:55:37 2018 +0900 # Node ID 9afe500ac808e74f2d1535ffc44d089b7cd729e5 # Parent 32caef1aff8134dc1ca37a7da9129fc865a4329d files: automatically populate fields referenced from template diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2141,9 +2141,10 @@ def forget(ui, repo, match, prefix, expl def files(ui, ctx, m, fm, fmt, subrepos): ret = 1 + needsfctx = ui.verbose or {'size', 'flags'} & fm.datahint() for f in ctx.matches(m): fm.startitem() - if ui.verbose: + if needsfctx: fc = ctx[f] fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags()) fm.data(abspath=f) diff --git a/tests/test-manifest.t b/tests/test-manifest.t --- a/tests/test-manifest.t +++ b/tests/test-manifest.t @@ -37,6 +37,10 @@ The next call is expected to return noth $ hg files -r . -X b a l + $ hg files -T '{path} {size} {flags}\n' + a 2 + b/a 2 x + l 1 l $ hg manifest -v 644 a