##// END OF EJS Templates
add tests for command line template....
Vadim Gelfer -
r1915:9598cde4 default
parent child Browse files
Show More
@@ -0,0 +1,91 b''
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'
@@ -0,0 +1,232 b''
1 transaction abort!
2 rollback completed
3 abort: date exceeds 32 bits: 11445678900
4 # default style is like normal output
5 --- log.out 2006-03-05 05:11:40.700065250 +0000
6 +++ style.out 2006-03-05 05:11:40.816072500 +0000
7 @@ -5,6 +5,7 @@
8 manifest: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1
9 user: other@place
10 date: Wed Dec 14 13:44:50 2005 +0000
11 +files:
12 files+: c
13 description:
14 no person
15 @@ -16,6 +17,7 @@
16 manifest: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55
17 user: A. N. Other <other@place>
18 date: Sun Aug 7 23:19:49 2005 +0000
19 +files:
20 files+: b
21 description:
22 other 1
23 @@ -30,6 +32,7 @@
24 manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
25 user: User Name <user@hostname>
26 date: Fri Mar 18 01:58:31 2005 +0000
27 +files:
28 files+: a
29 description:
30 line 1
31 # compact style works
32 2[tip] cdc488b3baa4 2005-12-14 13:44 +0000 other
33 no person
34
35 1 55b647117689 2005-08-07 23:19 +0000 other
36 other 1
37
38 0 debcd367d974 2005-03-18 01:58 +0000 user
39 line 1
40
41 2[tip] cdc488b3baa4 2005-12-14 13:44 +0000 other
42 no person
43
44 1 55b647117689 2005-08-07 23:19 +0000 other
45 other 1
46
47 0 debcd367d974 2005-03-18 01:58 +0000 user
48 line 1
49
50 2[tip]:1,-1 cdc488b3baa4 2005-12-14 13:44 +0000 other
51 no person
52
53 1:0,-1 55b647117689 2005-08-07 23:19 +0000 other
54 other 1
55
56 0:-1,-1 debcd367d974 2005-03-18 01:58 +0000 user
57 line 1
58
59 # error if style not readable
60 abort: Permission denied - ./q
61 # error if no style
62 abort: No such file or directory - notexist
63 # error if style missing key
64 abort: ./t: no key named 'changeset'
65 # error if include fails
66 abort: template file ./q: Permission denied
67 # include works
68 2
69 1
70 0
71 # ui.style works
72 2
73 1
74 0
75 # keys work
76 author: other@place
77 author: A. N. Other <other@place>
78 author: User Name <user@hostname>
79 author--verbose: other@place
80 author--verbose: A. N. Other <other@place>
81 author--verbose: User Name <user@hostname>
82 author--debug: other@place
83 author--debug: A. N. Other <other@place>
84 author--debug: User Name <user@hostname>
85 branches:
86 branches:
87 branches:
88 branches--verbose:
89 branches--verbose:
90 branches--verbose:
91 branches--debug:
92 branches--debug:
93 branches--debug:
94 date: 1134567890.00
95 date: 1123456789.00
96 date: 1111111111.00
97 date--verbose: 1134567890.00
98 date--verbose: 1123456789.00
99 date--verbose: 1111111111.00
100 date--debug: 1134567890.00
101 date--debug: 1123456789.00
102 date--debug: 1111111111.00
103 desc: no person
104 desc: other 1
105 other 2
106
107 other 3
108
109 desc: line 1
110 line 2
111
112 desc--verbose: no person
113 desc--verbose: other 1
114 other 2
115
116 other 3
117
118 desc--verbose: line 1
119 line 2
120
121 desc--debug: no person
122 desc--debug: other 1
123 other 2
124
125 other 3
126
127 desc--debug: line 1
128 line 2
129
130 file_adds:
131 file_adds:
132 file_adds:
133 file_adds--verbose:
134 file_adds--verbose:
135 file_adds--verbose:
136 file_adds--debug: c
137 file_adds--debug: b
138 file_adds--debug: a
139 file_dels:
140 file_dels:
141 file_dels:
142 file_dels--verbose:
143 file_dels--verbose:
144 file_dels--verbose:
145 file_dels--debug:
146 file_dels--debug:
147 file_dels--debug:
148 files: c
149 files: b
150 files: a
151 files--verbose: c
152 files--verbose: b
153 files--verbose: a
154 files--debug:
155 files--debug:
156 files--debug:
157 manifest:
158 manifest:
159 manifest:
160 manifest--verbose:
161 manifest--verbose:
162 manifest--verbose:
163 manifest--debug: 2:6e0e82995c35
164 manifest--debug: 1:4e8d705b1e53
165 manifest--debug: 0:a0c8bcbbb45c
166 node: cdc488b3baa4a2cf316d4d85a3a1f17c5e1695d8
167 node: 55b64711768911f37c6d244b12785623aa64e7c3
168 node: debcd367d97455db85bba7b583b14b166172de25
169 node--verbose: cdc488b3baa4a2cf316d4d85a3a1f17c5e1695d8
170 node--verbose: 55b64711768911f37c6d244b12785623aa64e7c3
171 node--verbose: debcd367d97455db85bba7b583b14b166172de25
172 node--debug: cdc488b3baa4a2cf316d4d85a3a1f17c5e1695d8
173 node--debug: 55b64711768911f37c6d244b12785623aa64e7c3
174 node--debug: debcd367d97455db85bba7b583b14b166172de25
175 parents:
176 parents:
177 parents:
178 parents--verbose:
179 parents--verbose:
180 parents--verbose:
181 parents--debug: 1:55b647117689 -1:000000000000
182 parents--debug: 0:debcd367d974 -1:000000000000
183 parents--debug: -1:000000000000 -1:000000000000
184 rev: 2
185 rev: 1
186 rev: 0
187 rev--verbose: 2
188 rev--verbose: 1
189 rev--verbose: 0
190 rev--debug: 2
191 rev--debug: 1
192 rev--debug: 0
193 tags: tip
194 tags:
195 tags:
196 tags--verbose: tip
197 tags--verbose:
198 tags--verbose:
199 tags--debug: tip
200 tags--debug:
201 tags--debug:
202 # filters work
203 place
204 place
205 hostname
206 other
207 A. N. Other
208 User Name
209 other
210 other
211 user
212 2 months
213 6 months
214 11 months
215 Wed Dec 14 13:44:50 2005 +0000
216 Sun Aug 7 23:19:49 2005 +0000
217 Fri Mar 18 01:58:31 2005 +0000
218 2005-12-14 13:44 +0000
219 2005-08-07 23:19 +0000
220 2005-03-18 01:58 +0000
221 Wed, 14 Dec 2005 13:44:50 +0000
222 Sun, 07 Aug 2005 23:19:49 +0000
223 Fri, 18 Mar 2005 01:58:31 +0000
224 no person
225 other 1
226 line 1
227 cdc488b3baa4
228 55b647117689
229 debcd367d974
230 # error on syntax
231 abort: t:3: unmatched quotes
232 # done
@@ -1,4 +1,4 b''
1 changeset = 'changeset: {rev}:{node|short}\n{tags}{short_parents}user: {author}\ndate: {date|date}\nsummary:\n{desc|firstline}\n\n'
1 changeset = 'changeset: {rev}:{node|short}\n{tags}{short_parents}user: {author}\ndate: {date|date}\nsummary: {desc|firstline}\n\n'
2 2 changeset_verbose = 'changeset: {rev}:{node}\n{tags}{parents}{manifest}user: {author}\ndate: {date|date}\nfiles: {files}\n{file_adds}{file_dels}description:\n{desc|strip}\n\n\n'
3 3 start_file_adds = 'files+: '
4 4 file_add = ' {file_add}'
General Comments 0
You need to be logged in to leave comments. Login now