test-command-template
125 lines
| 2.9 KiB
| text/plain
|
TextLexer
/ tests / test-command-template
Vadim Gelfer
|
r1915 | #!/bin/sh | ||
hg init a | ||||
cd a | ||||
echo a > a | ||||
hg add a | ||||
echo line 1 > b | ||||
echo line 2 >> b | ||||
Thomas Arendsen Hein
|
r1939 | hg commit -l b -d '1000000 0' -u 'User Name <user@hostname>' | ||
Vadim Gelfer
|
r1915 | hg add b | ||
echo other 1 > c | ||||
echo other 2 >> c | ||||
echo >> c | ||||
echo other 3 >> c | ||||
Thomas Arendsen Hein
|
r1939 | hg commit -l c -d '1100000 0' -u 'A. N. Other <other@place>' | ||
Vadim Gelfer
|
r1915 | hg add c | ||
Thomas Arendsen Hein
|
r1939 | hg commit -m 'no person' -d '1200000 0' -u 'other@place' | ||
Vadim Gelfer
|
r1915 | echo c >> c | ||
Thomas Arendsen Hein
|
r1939 | hg commit -m 'no user, no domain' -d '1300000 0' -u 'person' | ||
Thomas Arendsen Hein
|
r3463 | echo foo > .hg/branch | ||
hg commit -m 'new branch' -d '1400000 0' -u 'person' | ||||
TK Soh
|
r4353 | hg co -q 3 | ||
echo other 4 >> d | ||||
hg add d | ||||
hg commit -m 'new head' -d '1500000 0' -u 'person' | ||||
hg merge -q | ||||
hg commit -m 'merge' -d '1500001 0' -u 'person' | ||||
Thomas Arendsen Hein
|
r4825 | # second branch starting at nullrev | ||
hg update null | ||||
echo second > second | ||||
hg add second | ||||
hg commit -m second -d '1000000 0' -u 'User Name <user@hostname>' | ||||
Vadim Gelfer
|
r1915 | |||
# make sure user/global hgrc does not affect tests | ||||
echo '[ui]' > .hg/hgrc | ||||
echo 'logtemplate =' >> .hg/hgrc | ||||
echo 'style =' >> .hg/hgrc | ||||
echo '# default style is like normal output' | ||||
Thomas Arendsen Hein
|
r3459 | echo '# normal' | ||
Vadim Gelfer
|
r1915 | hg log > log.out | ||
hg log --style default > style.out | ||||
Vadim Gelfer
|
r1916 | diff log.out style.out | ||
Thomas Arendsen Hein
|
r3459 | echo '# verbose' | ||
Vadim Gelfer
|
r1915 | hg log -v > log.out | ||
hg log -v --style default > style.out | ||||
Vadim Gelfer
|
r1916 | diff log.out style.out | ||
Thomas Arendsen Hein
|
r3459 | echo '# debug' | ||
Vadim Gelfer
|
r1915 | hg log --debug > log.out | ||
hg log --debug --style default > style.out | ||||
Vadim Gelfer
|
r1916 | diff log.out style.out | ||
Vadim Gelfer
|
r1915 | |||
Alexis S. L. Carvalho
|
r4351 | echo '# revision with no copies (used to print a traceback)' | ||
hg tip -v --template '\n' | ||||
Vadim Gelfer
|
r1915 | echo '# compact style works' | ||
hg log --style compact | ||||
hg log -v --style compact | ||||
hg log --debug --style compact | ||||
echo '# error if style not readable' | ||||
touch q | ||||
chmod 0 q | ||||
hg log --style ./q | ||||
echo '# error if no style' | ||||
hg log --style notexist | ||||
echo '# error if style missing key' | ||||
echo 'q = q' > t | ||||
hg log --style ./t | ||||
echo '# error if include fails' | ||||
echo 'changeset = q' >> t | ||||
hg log --style ./t | ||||
echo '# include works' | ||||
Thomas Arendsen Hein
|
r3988 | rm q | ||
Vadim Gelfer
|
r1915 | echo '{rev}' > q | ||
hg log --style ./t | ||||
echo '# ui.style works' | ||||
echo '[ui]' > .hg/hgrc | ||||
echo 'style = t' >> .hg/hgrc | ||||
hg log | ||||
Thomas Arendsen Hein
|
r3193 | echo '# issue338' | ||
hg log --style=changelog > changelog | ||||
cat changelog | ||||
Vadim Gelfer
|
r1915 | echo "# keys work" | ||
Patrick Mezard
|
r5550 | for key in author branches date desc file_adds file_dels file_mods \ | ||
files manifest node parents rev tags; do | ||||
Vadim Gelfer
|
r1915 | for mode in '' --verbose --debug; do | ||
hg log $mode --template "$key$mode: {$key}\n" | ||||
done | ||||
done | ||||
echo '# filters work' | ||||
hg log --template '{author|domain}\n' | ||||
hg log --template '{author|person}\n' | ||||
hg log --template '{author|user}\n' | ||||
Vadim Gelfer
|
r1916 | hg log --template '{date|age}\n' > /dev/null || exit 1 | ||
Vadim Gelfer
|
r1915 | hg log --template '{date|date}\n' | ||
hg log --template '{date|isodate}\n' | ||||
hg log --template '{date|rfc822date}\n' | ||||
hg log --template '{desc|firstline}\n' | ||||
hg log --template '{node|short}\n' | ||||
Jesse Glick
|
r6174 | hg log --template '<changeset author="{author|xmlescape}"/>\n' | ||
Vadim Gelfer
|
r1915 | |||
Alexis S. L. Carvalho
|
r4352 | echo '# formatnode filter works' | ||
echo '# quiet' | ||||
hg -q log -r 0 --template '#node|formatnode#\n' | ||||
echo '# normal' | ||||
hg log -r 0 --template '#node|formatnode#\n' | ||||
echo '# verbose' | ||||
hg -v log -r 0 --template '#node|formatnode#\n' | ||||
echo '# debug' | ||||
hg --debug log -r 0 --template '#node|formatnode#\n' | ||||
Vadim Gelfer
|
r1915 | echo '# error on syntax' | ||
echo 'x = "f' >> t | ||||
hg log | ||||
echo '# done' | ||||