comparison tests/test-branches.t @ 32952:61b60b28c381

formatter: add support for parts map of [templates] section Unlike a mapfile whose template is looked up by spec -> mapfile -> topic, [templates] section is global. We use :sub-section syntax to define parts per template.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 22 Apr 2017 21:29:00 +0900
parents 5100ce217dfa
children abf91c4f9608
comparison
equal deleted inserted replaced
32951:050efe9a1644 32952:61b60b28c381
541 {"branch": "b", "node": "e23b5505d1ad"}, 541 {"branch": "b", "node": "e23b5505d1ad"},
542 {"branch": "a branch *", "node": "10ff5895aa57"}, (glob) 542 {"branch": "a branch *", "node": "10ff5895aa57"}, (glob)
543 {"branch": "a", "node": "d8cbc61dbaa6"}, 543 {"branch": "a", "node": "d8cbc61dbaa6"},
544 {"branch": "default", "node": "19709c5a4e75"} 544 {"branch": "default", "node": "19709c5a4e75"}
545 } 545 }
546
547 $ cat <<'EOF' >> .hg/hgrc
548 > [templates]
549 > myjson = ' {dict(branch, node|short)|json}'
550 > myjson:docheader = '\{\n'
551 > myjson:docfooter = '\n}\n'
552 > myjson:separator = ',\n'
553 > EOF
554 $ hg branches -T myjson
555 {
556 {"branch": "b", "node": "e23b5505d1ad"},
557 {"branch": "a branch *", "node": "10ff5895aa57"}, (glob)
558 {"branch": "a", "node": "d8cbc61dbaa6"},
559 {"branch": "default", "node": "19709c5a4e75"}
560 }
561
562 $ cat <<'EOF' >> .hg/hgrc
563 > [templates]
564 > :docheader = 'should not be selected as a docheader for literal templates\n'
565 > EOF
566 $ hg branches -T '{branch}\n'
567 b
568 a branch name much longer than the default justification used by branches
569 a
570 default
546 571
547 Tests of revision branch name caching 572 Tests of revision branch name caching
548 573
549 We rev branch cache is updated automatically. In these tests we use a trick to 574 We rev branch cache is updated automatically. In these tests we use a trick to
550 trigger rebuilds. We remove the branch head cache and run 'hg head' to cause a 575 trigger rebuilds. We remove the branch head cache and run 'hg head' to cause a