Mercurial > hg
comparison tests/test-command-template @ 1915:9598cde4756d
add tests for command line template.
fix default template problem found in test.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Sat, 04 Mar 2006 21:12:53 -0800 |
parents | |
children | 95b2e14841f5 |
comparison
equal
deleted
inserted
replaced
1914:a5bf0030df5f | 1915:9598cde4756d |
---|---|
1 #!/bin/sh | |
2 | |
3 hg init a | |
4 cd a | |
5 echo a > a | |
6 hg add a | |
7 echo line 1 > b | |
8 echo line 2 >> b | |
9 hg commit -l b -d '1111111111 0' -u 'User Name <user@hostname>' | |
10 hg add b | |
11 echo other 1 > c | |
12 echo other 2 >> c | |
13 echo >> c | |
14 echo other 3 >> c | |
15 hg commit -l c -d '1123456789 0' -u 'A. N. Other <other@place>' | |
16 hg add c | |
17 hg commit -m 'no person' -d '1134567890 0' -u 'other@place' | |
18 echo c >> c | |
19 hg commit -m 'no user, no domain' -d '11445678900 0' -u 'person' | |
20 | |
21 # make sure user/global hgrc does not affect tests | |
22 echo '[ui]' > .hg/hgrc | |
23 echo 'logtemplate =' >> .hg/hgrc | |
24 echo 'style =' >> .hg/hgrc | |
25 | |
26 echo '# default style is like normal output' | |
27 hg log > log.out | |
28 hg log --style default > style.out | |
29 diff -u log.out style.out | |
30 hg log -v > log.out | |
31 hg log -v --style default > style.out | |
32 diff -u log.out style.out | |
33 hg log --debug > log.out | |
34 hg log --debug --style default > style.out | |
35 diff -u log.out style.out | |
36 | |
37 echo '# compact style works' | |
38 hg log --style compact | |
39 hg log -v --style compact | |
40 hg log --debug --style compact | |
41 | |
42 echo '# error if style not readable' | |
43 touch q | |
44 chmod 0 q | |
45 hg log --style ./q | |
46 | |
47 echo '# error if no style' | |
48 hg log --style notexist | |
49 | |
50 echo '# error if style missing key' | |
51 echo 'q = q' > t | |
52 hg log --style ./t | |
53 | |
54 echo '# error if include fails' | |
55 echo 'changeset = q' >> t | |
56 hg log --style ./t | |
57 | |
58 echo '# include works' | |
59 rm -f q | |
60 echo '{rev}' > q | |
61 hg log --style ./t | |
62 | |
63 echo '# ui.style works' | |
64 echo '[ui]' > .hg/hgrc | |
65 echo 'style = t' >> .hg/hgrc | |
66 hg log | |
67 | |
68 echo "# keys work" | |
69 for key in author branches date desc file_adds file_dels files \ | |
70 manifest node parents rev tags; do | |
71 for mode in '' --verbose --debug; do | |
72 hg log $mode --template "$key$mode: {$key}\n" | |
73 done | |
74 done | |
75 | |
76 echo '# filters work' | |
77 hg log --template '{author|domain}\n' | |
78 hg log --template '{author|person}\n' | |
79 hg log --template '{author|user}\n' | |
80 hg log --template '{date|age}\n' | |
81 hg log --template '{date|date}\n' | |
82 hg log --template '{date|isodate}\n' | |
83 hg log --template '{date|rfc822date}\n' | |
84 hg log --template '{desc|firstline}\n' | |
85 hg log --template '{node|short}\n' | |
86 | |
87 echo '# error on syntax' | |
88 echo 'x = "f' >> t | |
89 hg log | |
90 | |
91 echo '# done' |