comparison tests/test-command-template.t @ 27894:a94f7eef3199

templatekw: add {namespaces} keyword This provides a general-purpose interface to all custom namespaces. The {namespaces} keyword honors the definition order of namespaces as they are kept by sortdict.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 12 Jan 2016 23:56:48 +0900
parents baa77652be68
children 7ed3a3c0cef1
comparison
equal deleted inserted replaced
27893:b42b2e86ef02 27894:a94f7eef3199
3302 $ hg log --template "{rev} {ifcontains('foo', bookmarks, 't', 'f')}\n" 3302 $ hg log --template "{rev} {ifcontains('foo', bookmarks, 't', 'f')}\n"
3303 2 t 3303 2 t
3304 1 f 3304 1 f
3305 0 f 3305 0 f
3306 3306
3307 Test namespaces dict
3308
3309 $ hg log -T '{rev}{namespaces % " {namespace}={join(names, ",")}"}\n'
3310 2 bookmarks=bar,foo tags=tip branches=text.{rev}
3311 1 bookmarks=baz tags= branches=text.{rev}
3312 0 bookmarks= tags= branches=default
3313 $ hg log -r2 -T '{namespaces % "{namespace}: {names}\n"}'
3314 bookmarks: bar foo
3315 tags: tip
3316 branches: text.{rev}
3317 $ hg log -r2 -T '{namespaces % "{namespace}:\n{names % " {name}\n"}"}'
3318 bookmarks:
3319 bar
3320 foo
3321 tags:
3322 tip
3323 branches:
3324 text.{rev}
3325 $ hg log -r2 -T '{get(namespaces, "bookmarks") % "{name}\n"}'
3326 bar
3327 foo
3328
3307 Test stringify on sub expressions 3329 Test stringify on sub expressions
3308 3330
3309 $ cd .. 3331 $ cd ..
3310 $ hg log -R a -r 8 --template '{join(files, if("1", if("1", ", ")))}\n' 3332 $ hg log -R a -r 8 --template '{join(files, if("1", if("1", ", ")))}\n'
3311 fourth, second, third 3333 fourth, second, third