Mercurial > hg
comparison tests/test-command-template.t @ 37223:08e042f0a67c
templatefilters: declare input type as bytes where appropriate
Some test outputs changed since input is now coerced to a byte string. I
think that's okay. Maybe {date} should have some readable representation?
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 18 Mar 2018 15:42:28 +0900 |
parents | e7bc0667c521 |
children | 9bcf096a2da2 |
comparison
equal
deleted
inserted
replaced
37222:54355c243042 | 37223:08e042f0a67c |
---|---|
2282 $ hg log -r0 --template '{branch|upper}\n' | 2282 $ hg log -r0 --template '{branch|upper}\n' |
2283 DEFAULT | 2283 DEFAULT |
2284 $ hg log -r0 --template '{author|lower}\n' | 2284 $ hg log -r0 --template '{author|lower}\n' |
2285 user name <user@hostname> | 2285 user name <user@hostname> |
2286 $ hg log -r0 --template '{date|upper}\n' | 2286 $ hg log -r0 --template '{date|upper}\n' |
2287 abort: template filter 'upper' is not compatible with keyword 'date' | 2287 1000000.00 |
2288 [255] | |
2289 | 2288 |
2290 Add a commit that does all possible modifications at once | 2289 Add a commit that does all possible modifications at once |
2291 | 2290 |
2292 $ echo modify >> third | 2291 $ echo modify >> third |
2293 $ touch b | 2292 $ touch b |
2795 (group | 2794 (group |
2796 None)) | 2795 None)) |
2797 hg: parse error: missing argument | 2796 hg: parse error: missing argument |
2798 [255] | 2797 [255] |
2799 | 2798 |
2800 Behind the scenes, this will throw TypeError | 2799 Behind the scenes, this would throw TypeError without intype=bytes |
2801 | 2800 |
2802 $ hg log -l 3 --template '{date|obfuscate}\n' | 2801 $ hg log -l 3 --template '{date|obfuscate}\n' |
2803 abort: template filter 'obfuscate' is not compatible with keyword 'date' | 2802 0.00 |
2804 [255] | 2803 0.00 |
2804 1577872860.00 | |
2805 | 2805 |
2806 Behind the scenes, this will throw a ValueError | 2806 Behind the scenes, this will throw a ValueError |
2807 | 2807 |
2808 $ hg log -l 3 --template 'line: {desc|shortdate}\n' | 2808 $ hg log -l 3 --template 'line: {desc|shortdate}\n' |
2809 abort: template filter 'shortdate' is not compatible with keyword 'desc' | 2809 abort: template filter 'shortdate' is not compatible with keyword 'desc' |
2810 [255] | 2810 [255] |
2811 | 2811 |
2812 Behind the scenes, this will throw AttributeError | 2812 Behind the scenes, this would throw AttributeError without intype=bytes |
2813 | 2813 |
2814 $ hg log -l 3 --template 'line: {date|escape}\n' | 2814 $ hg log -l 3 --template 'line: {date|escape}\n' |
2815 abort: template filter 'escape' is not compatible with keyword 'date' | 2815 line: 0.00 |
2816 [255] | 2816 line: 0.00 |
2817 line: 1577872860.00 | |
2817 | 2818 |
2818 $ hg log -l 3 --template 'line: {extras|localdate}\n' | 2819 $ hg log -l 3 --template 'line: {extras|localdate}\n' |
2819 hg: parse error: localdate expects a date information | 2820 hg: parse error: localdate expects a date information |
2820 [255] | 2821 [255] |
2821 | 2822 |
4654 $ HGENCODING=latin1 hg log -T "decoded: {'`cat latin1`'|utf8|hex}\n" -l1 | 4655 $ HGENCODING=latin1 hg log -T "decoded: {'`cat latin1`'|utf8|hex}\n" -l1 |
4655 decoded: c3a9 | 4656 decoded: c3a9 |
4656 $ HGENCODING=ascii hg log -T "replaced: {'`cat latin1`'|utf8|hex}\n" -l1 | 4657 $ HGENCODING=ascii hg log -T "replaced: {'`cat latin1`'|utf8|hex}\n" -l1 |
4657 abort: decoding near * (glob) | 4658 abort: decoding near * (glob) |
4658 [255] | 4659 [255] |
4659 $ hg log -T "invalid type: {rev|utf8}\n" -r0 | 4660 $ hg log -T "coerced to string: {rev|utf8}\n" -r0 |
4660 abort: template filter 'utf8' is not compatible with keyword 'rev' | 4661 coerced to string: 0 |
4661 [255] | |
4662 | 4662 |
4663 pad width: | 4663 pad width: |
4664 | 4664 |
4665 $ HGENCODING=utf-8 hg debugtemplate "{pad('`cat utf-8`', 2, '-')}\n" | 4665 $ HGENCODING=utf-8 hg debugtemplate "{pad('`cat utf-8`', 2, '-')}\n" |
4666 \xc3\xa9- (esc) | 4666 \xc3\xa9- (esc) |