Mercurial > hg-stable
comparison tests/test-command-template.t @ 24240:bd504d90588d
templater: implement _hybrid.__contains__ so that ifcontains can accept dict
d8fb835376d1 is fine for "{revset()}", but "i.values()[0]" does not work if
each item has more than one values such as "{bookmarks}".
This fixes the problem by using list.__contains__ or dict.__contains__
appropriately.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 18 Feb 2015 23:01:33 +0900 |
parents | d091f62be5ae |
children | e7baf88c29c3 |
comparison
equal
deleted
inserted
replaced
24239:31f9b1b16d1e | 24240:bd504d90588d |
---|---|
45 | 45 |
46 $ hg log --template '{join(file_copies, ",\n")}\n' -r . | 46 $ hg log --template '{join(file_copies, ",\n")}\n' -r . |
47 fourth (second) | 47 fourth (second) |
48 $ hg log -T '{file_copies % "{source} -> {name}\n"}' -r . | 48 $ hg log -T '{file_copies % "{source} -> {name}\n"}' -r . |
49 second -> fourth | 49 second -> fourth |
50 $ hg log -T '{rev} {ifcontains("fourth", file_copies, "t", "f")}\n' -r .:7 | |
51 8 t | |
52 7 f | |
50 | 53 |
51 Quoting for ui.logtemplate | 54 Quoting for ui.logtemplate |
52 | 55 |
53 $ hg tip --config "ui.logtemplate={rev}\n" | 56 $ hg tip --config "ui.logtemplate={rev}\n" |
54 8 | 57 8 |
2384 $ hg book -r1 baz | 2387 $ hg book -r1 baz |
2385 $ hg log --template "{rev} {join(bookmarks, ' ')}\n" | 2388 $ hg log --template "{rev} {join(bookmarks, ' ')}\n" |
2386 2 bar foo | 2389 2 bar foo |
2387 1 baz | 2390 1 baz |
2388 0 | 2391 0 |
2392 $ hg log --template "{rev} {ifcontains('foo', bookmarks, 't', 'f')}\n" | |
2393 2 t | |
2394 1 f | |
2395 0 f | |
2389 | 2396 |
2390 Test stringify on sub expressions | 2397 Test stringify on sub expressions |
2391 | 2398 |
2392 $ cd .. | 2399 $ cd .. |
2393 $ hg log -R a -r 8 --template '{join(files, if("1", if("1", ", ")))}\n' | 2400 $ hg log -R a -r 8 --template '{join(files, if("1", if("1", ", ")))}\n' |