comparison mercurial/cmdutil.py @ 38542:475f5f86eaed

files: automatically populate fields referenced from template
author Yuya Nishihara <yuya@tcha.org>
date Sun, 01 Jul 2018 21:55:37 +0900
parents b1bbff1dd99a
children 7ae0ea739770
comparison
equal deleted inserted replaced
38541:1e25782a7583 38542:475f5f86eaed
2139 return bad, forgot 2139 return bad, forgot
2140 2140
2141 def files(ui, ctx, m, fm, fmt, subrepos): 2141 def files(ui, ctx, m, fm, fmt, subrepos):
2142 ret = 1 2142 ret = 1
2143 2143
2144 needsfctx = ui.verbose or {'size', 'flags'} & fm.datahint()
2144 for f in ctx.matches(m): 2145 for f in ctx.matches(m):
2145 fm.startitem() 2146 fm.startitem()
2146 if ui.verbose: 2147 if needsfctx:
2147 fc = ctx[f] 2148 fc = ctx[f]
2148 fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags()) 2149 fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags())
2149 fm.data(abspath=f) 2150 fm.data(abspath=f)
2150 fm.write('path', fmt, m.rel(f)) 2151 fm.write('path', fmt, m.rel(f))
2151 ret = 0 2152 ret = 0