comparison mercurial/cmdutil.py @ 39396:34ba47117164

formatter: rename {abspath}/{file} to {path}, and drop relative {path} (BC) Note that {path} in status is either relative-to-cwd or repository-absolute depending on the command argument and config knob, which can't be reproduced by using the {path|relpath} filter. The default template is updated to always use a relative path. .. bc:: ``{abspath}`` and ``{file}`` in generic templates are renamed to ``{path}``. Any ``{path}`` is a repository-absolute path. Use ``{path|relpath}`` to convert it to a filesystem path.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 05 Aug 2018 16:44:16 +0900
parents 5b92a717bfc1
children 90afd61ef8a2
comparison
equal deleted inserted replaced
39395:5b1d406b39f1 39396:34ba47117164
2174 fm.startitem() 2174 fm.startitem()
2175 fm.context(ctx=ctx) 2175 fm.context(ctx=ctx)
2176 if needsfctx: 2176 if needsfctx:
2177 fc = ctx[f] 2177 fc = ctx[f]
2178 fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags()) 2178 fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags())
2179 fm.data(abspath=f) 2179 fm.data(path=f)
2180 fm.write('path', fmt, m.rel(f)) 2180 fm.plain(fmt % m.rel(f))
2181 ret = 0 2181 ret = 0
2182 2182
2183 for subpath in sorted(ctx.substate): 2183 for subpath in sorted(ctx.substate):
2184 submatch = matchmod.subdirmatcher(subpath, m) 2184 submatch = matchmod.subdirmatcher(subpath, m)
2185 if (subrepos or m.exact(subpath) or any(submatch.files())): 2185 if (subrepos or m.exact(subpath) or any(submatch.files())):
2321 if decode: 2321 if decode:
2322 data = ctx.repo().wwritedata(path, data) 2322 data = ctx.repo().wwritedata(path, data)
2323 fm.startitem() 2323 fm.startitem()
2324 fm.context(ctx=ctx) 2324 fm.context(ctx=ctx)
2325 fm.write('data', '%s', data) 2325 fm.write('data', '%s', data)
2326 fm.data(abspath=path, path=matcher.rel(path)) 2326 fm.data(path=path)
2327 2327
2328 def cat(ui, repo, ctx, matcher, basefm, fntemplate, prefix, **opts): 2328 def cat(ui, repo, ctx, matcher, basefm, fntemplate, prefix, **opts):
2329 err = 1 2329 err = 1
2330 opts = pycompat.byteskwargs(opts) 2330 opts = pycompat.byteskwargs(opts)
2331 2331