Blame


1 b85a3496 2023-04-14 thomas #!/bin/sh
2 b85a3496 2023-04-14 thomas #
3 b85a3496 2023-04-14 thomas # Copyright (c) 2023 Mark Jamsek <mark@jamsek.dev>
4 b85a3496 2023-04-14 thomas #
5 b85a3496 2023-04-14 thomas # Permission to use, copy, modify, and distribute this software for any
6 b85a3496 2023-04-14 thomas # purpose with or without fee is hereby granted, provided that the above
7 b85a3496 2023-04-14 thomas # copyright notice and this permission notice appear in all copies.
8 b85a3496 2023-04-14 thomas #
9 b85a3496 2023-04-14 thomas # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 b85a3496 2023-04-14 thomas # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 b85a3496 2023-04-14 thomas # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 b85a3496 2023-04-14 thomas # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 b85a3496 2023-04-14 thomas # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 b85a3496 2023-04-14 thomas # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 b85a3496 2023-04-14 thomas # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 b85a3496 2023-04-14 thomas
17 b85a3496 2023-04-14 thomas . ./common.sh
18 b85a3496 2023-04-14 thomas
19 b85a3496 2023-04-14 thomas test_log_hsplit_diff()
20 b85a3496 2023-04-14 thomas {
21 b85a3496 2023-04-14 thomas test_init log_hsplit_diff
22 b85a3496 2023-04-14 thomas
23 b85a3496 2023-04-14 thomas local head_id=`git_show_head $testroot/repo`
24 b85a3496 2023-04-14 thomas local author_time=`git_show_author_time $testroot/repo`
25 b85a3496 2023-04-14 thomas local date=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
26 b85a3496 2023-04-14 thomas local ymd=`date -u -r $author_time +"%G-%m-%d"`
27 b85a3496 2023-04-14 thomas
28 fa9bb690 2023-04-22 thomas cat <<EOF >$TOG_TEST_SCRIPT
29 b85a3496 2023-04-14 thomas KEY_ENTER open diff view of selected commit
30 b85a3496 2023-04-14 thomas S toggle horizontal split
31 b85a3496 2023-04-14 thomas SCREENDUMP
32 b85a3496 2023-04-14 thomas EOF
33 b85a3496 2023-04-14 thomas
34 b85a3496 2023-04-14 thomas cat <<EOF >$testroot/view.expected
35 b85a3496 2023-04-14 thomas commit $head_id [1/1] master
36 9472af95 2023-05-15 thomas $ymd flan_hacker [master] adding the test tree
37 b85a3496 2023-04-14 thomas
38 b85a3496 2023-04-14 thomas
39 b85a3496 2023-04-14 thomas
40 b85a3496 2023-04-14 thomas
41 b85a3496 2023-04-14 thomas --------------------------------------------------------------------------------
42 b85a3496 2023-04-14 thomas [1/40] diff /dev/null $head_id
43 b85a3496 2023-04-14 thomas commit $head_id (master)
44 b85a3496 2023-04-14 thomas from: Flan Hacker <flan_hacker@openbsd.org>
45 b85a3496 2023-04-14 thomas date: $date
46 b85a3496 2023-04-14 thomas
47 b85a3496 2023-04-14 thomas adding the test tree
48 b85a3496 2023-04-14 thomas
49 b85a3496 2023-04-14 thomas A alpha | 1+ 0-
50 b85a3496 2023-04-14 thomas A beta | 1+ 0-
51 b85a3496 2023-04-14 thomas A epsilon/zeta | 1+ 0-
52 b85a3496 2023-04-14 thomas A gamma/delta | 1+ 0-
53 b85a3496 2023-04-14 thomas
54 b85a3496 2023-04-14 thomas 4 files changed, 4 insertions(+), 0 deletions(-)
55 b85a3496 2023-04-14 thomas
56 b85a3496 2023-04-14 thomas commit - /dev/null
57 b85a3496 2023-04-14 thomas commit + $head_id
58 b85a3496 2023-04-14 thomas blob - /dev/null
59 b85a3496 2023-04-14 thomas EOF
60 b85a3496 2023-04-14 thomas
61 b85a3496 2023-04-14 thomas cd $testroot/repo && tog log
62 b85a3496 2023-04-14 thomas cmp -s $testroot/view.expected $testroot/view
63 b85a3496 2023-04-14 thomas ret=$?
64 b85a3496 2023-04-14 thomas if [ $ret -ne 0 ]; then
65 b85a3496 2023-04-14 thomas diff -u $testroot/view.expected $testroot/view
66 b85a3496 2023-04-14 thomas test_done "$testroot" "$ret"
67 b85a3496 2023-04-14 thomas return 1
68 b85a3496 2023-04-14 thomas fi
69 b85a3496 2023-04-14 thomas
70 b85a3496 2023-04-14 thomas test_done "$testroot" "$ret"
71 b85a3496 2023-04-14 thomas }
72 b85a3496 2023-04-14 thomas
73 b85a3496 2023-04-14 thomas test_log_vsplit_diff()
74 b85a3496 2023-04-14 thomas {
75 b85a3496 2023-04-14 thomas # make screen wide enough for vsplit
76 b85a3496 2023-04-14 thomas test_init log_vsplit_diff 142
77 b85a3496 2023-04-14 thomas
78 b85a3496 2023-04-14 thomas local head_id=`git_show_head $testroot/repo`
79 b85a3496 2023-04-14 thomas local author_time=`git_show_author_time $testroot/repo`
80 b85a3496 2023-04-14 thomas local date=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
81 b85a3496 2023-04-14 thomas local ymd=`date -u -r $author_time +"%G-%m-%d"`
82 b85a3496 2023-04-14 thomas local blobid_alpha=`get_blob_id $testroot/repo "" alpha`
83 b85a3496 2023-04-14 thomas local blobid_beta=`get_blob_id $testroot/repo "" beta`
84 b85a3496 2023-04-14 thomas
85 fa9bb690 2023-04-22 thomas cat <<EOF >$TOG_TEST_SCRIPT
86 b85a3496 2023-04-14 thomas KEY_ENTER open diff view of selected commit in vertical split
87 b85a3496 2023-04-14 thomas SCREENDUMP
88 b85a3496 2023-04-14 thomas EOF
89 b85a3496 2023-04-14 thomas
90 b85a3496 2023-04-14 thomas cat <<EOF >$testroot/view.expected
91 b85a3496 2023-04-14 thomas commit $head_id [1/1] master |[1/40] diff /dev/null $head_id
92 9472af95 2023-05-15 thomas $ymd flan_hacker [master] adding the test tree |commit $head_id (master)
93 b85a3496 2023-04-14 thomas |from: Flan Hacker <flan_hacker@openbsd.org>
94 b85a3496 2023-04-14 thomas |date: $date
95 b85a3496 2023-04-14 thomas |
96 b85a3496 2023-04-14 thomas |adding the test tree
97 b85a3496 2023-04-14 thomas |
98 b85a3496 2023-04-14 thomas |A alpha | 1+ 0-
99 b85a3496 2023-04-14 thomas |A beta | 1+ 0-
100 b85a3496 2023-04-14 thomas |A epsilon/zeta | 1+ 0-
101 b85a3496 2023-04-14 thomas |A gamma/delta | 1+ 0-
102 b85a3496 2023-04-14 thomas |
103 b85a3496 2023-04-14 thomas |4 files changed, 4 insertions(+), 0 deletions(-)
104 b85a3496 2023-04-14 thomas |
105 b85a3496 2023-04-14 thomas |commit - /dev/null
106 b85a3496 2023-04-14 thomas |commit + $head_id
107 b85a3496 2023-04-14 thomas |blob - /dev/null
108 b85a3496 2023-04-14 thomas |blob + $blobid_alpha (mode 644)
109 b85a3496 2023-04-14 thomas |--- /dev/null
110 b85a3496 2023-04-14 thomas |+++ alpha
111 b85a3496 2023-04-14 thomas |@@ -0,0 +1 @@
112 b85a3496 2023-04-14 thomas |+alpha
113 b85a3496 2023-04-14 thomas |blob - /dev/null
114 b85a3496 2023-04-14 thomas |blob + $blobid_beta (mode 644)
115 b85a3496 2023-04-14 thomas EOF
116 b85a3496 2023-04-14 thomas
117 b85a3496 2023-04-14 thomas cd $testroot/repo && tog log
118 b85a3496 2023-04-14 thomas cmp -s $testroot/view.expected $testroot/view
119 b85a3496 2023-04-14 thomas ret=$?
120 b85a3496 2023-04-14 thomas if [ $ret -ne 0 ]; then
121 b85a3496 2023-04-14 thomas diff -u $testroot/view.expected $testroot/view
122 b85a3496 2023-04-14 thomas test_done "$testroot" "$ret"
123 b85a3496 2023-04-14 thomas return 1
124 b85a3496 2023-04-14 thomas fi
125 b85a3496 2023-04-14 thomas
126 b85a3496 2023-04-14 thomas test_done "$testroot" "$ret"
127 b85a3496 2023-04-14 thomas }
128 b85a3496 2023-04-14 thomas
129 b85a3496 2023-04-14 thomas test_log_show_author()
130 b85a3496 2023-04-14 thomas {
131 b85a3496 2023-04-14 thomas # make view wide enough to show id
132 b85a3496 2023-04-14 thomas test_init log_show_author 120 4
133 b85a3496 2023-04-14 thomas
134 b85a3496 2023-04-14 thomas local head_id=`git_show_head $testroot/repo`
135 b85a3496 2023-04-14 thomas local author_time=`git_show_author_time $testroot/repo`
136 b85a3496 2023-04-14 thomas local date=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
137 b85a3496 2023-04-14 thomas local ymd=`date -u -r $author_time +"%G-%m-%d"`
138 b85a3496 2023-04-14 thomas local head_id_len8=`trim_obj_id 32 $head_id`
139 b85a3496 2023-04-14 thomas
140 b85a3496 2023-04-14 thomas echo "mod alpha" > $testroot/repo/alpha
141 b85a3496 2023-04-14 thomas cd $testroot/repo && git add .
142 b85a3496 2023-04-14 thomas cd $testroot/repo && \
143 b85a3496 2023-04-14 thomas git commit --author "Johnny Cash <john@cash.net>" -m author > \
144 b85a3496 2023-04-14 thomas /dev/null
145 b85a3496 2023-04-14 thomas
146 b85a3496 2023-04-14 thomas local commit1=`git_show_head $testroot/repo`
147 b85a3496 2023-04-14 thomas local id1_len8=`trim_obj_id 32 $commit1`
148 b85a3496 2023-04-14 thomas
149 fa9bb690 2023-04-22 thomas cat <<EOF >$TOG_TEST_SCRIPT
150 b85a3496 2023-04-14 thomas @ toggle show author
151 b85a3496 2023-04-14 thomas SCREENDUMP
152 b85a3496 2023-04-14 thomas EOF
153 b85a3496 2023-04-14 thomas
154 b85a3496 2023-04-14 thomas cat <<EOF >$testroot/view.expected
155 b85a3496 2023-04-14 thomas commit $commit1 [1/2] master
156 9472af95 2023-05-15 thomas $ymd $id1_len8 john [master] author
157 b85a3496 2023-04-14 thomas $ymd $head_id_len8 flan_hacker adding the test tree
158 b85a3496 2023-04-14 thomas :show commit author
159 b85a3496 2023-04-14 thomas EOF
160 b85a3496 2023-04-14 thomas
161 b85a3496 2023-04-14 thomas cd $testroot/repo && tog log
162 b85a3496 2023-04-14 thomas cmp -s $testroot/view.expected $testroot/view
163 b85a3496 2023-04-14 thomas ret=$?
164 b85a3496 2023-04-14 thomas if [ $ret -ne 0 ]; then
165 b85a3496 2023-04-14 thomas diff -u $testroot/view.expected $testroot/view
166 b85a3496 2023-04-14 thomas test_done "$testroot" "$ret"
167 b85a3496 2023-04-14 thomas return 1
168 b85a3496 2023-04-14 thomas fi
169 b85a3496 2023-04-14 thomas
170 b85a3496 2023-04-14 thomas test_done "$testroot" "$ret"
171 b85a3496 2023-04-14 thomas }
172 b85a3496 2023-04-14 thomas
173 b85a3496 2023-04-14 thomas test_log_scroll_right()
174 b85a3496 2023-04-14 thomas {
175 b85a3496 2023-04-14 thomas test_init log_scroll_right 80 3
176 b85a3496 2023-04-14 thomas
177 b85a3496 2023-04-14 thomas local head_id=`git_show_head $testroot/repo`
178 b85a3496 2023-04-14 thomas local author_time=`git_show_author_time $testroot/repo`
179 b85a3496 2023-04-14 thomas local date=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
180 b85a3496 2023-04-14 thomas local ymd=`date -u -r $author_time +"%G-%m-%d"`
181 b85a3496 2023-04-14 thomas local msg="scroll this log message to the right four characters"
182 9472af95 2023-05-15 thomas local scrolled_msg="ter] scroll this log message to the right four character"
183 b85a3496 2023-04-14 thomas
184 b85a3496 2023-04-14 thomas echo "mod alpha" > $testroot/repo/alpha
185 b85a3496 2023-04-14 thomas cd $testroot/repo && git add . && git commit -m "$msg" > /dev/null
186 b85a3496 2023-04-14 thomas
187 b85a3496 2023-04-14 thomas local commit1=`git_show_head $testroot/repo`
188 b85a3496 2023-04-14 thomas
189 fa9bb690 2023-04-22 thomas cat <<EOF >$TOG_TEST_SCRIPT
190 b85a3496 2023-04-14 thomas l scroll right
191 b85a3496 2023-04-14 thomas l scroll right
192 b85a3496 2023-04-14 thomas SCREENDUMP
193 b85a3496 2023-04-14 thomas EOF
194 b85a3496 2023-04-14 thomas
195 b85a3496 2023-04-14 thomas cat <<EOF >$testroot/view.expected
196 b85a3496 2023-04-14 thomas commit $commit1 [1/2] master
197 b85a3496 2023-04-14 thomas $ymd flan_hacker $scrolled_msg
198 b85a3496 2023-04-14 thomas $ymd flan_hacker ng the test tree
199 b85a3496 2023-04-14 thomas EOF
200 b85a3496 2023-04-14 thomas
201 b85a3496 2023-04-14 thomas cd $testroot/repo && tog log
202 b85a3496 2023-04-14 thomas cmp -s $testroot/view.expected $testroot/view
203 b85a3496 2023-04-14 thomas ret=$?
204 b85a3496 2023-04-14 thomas if [ $ret -ne 0 ]; then
205 b85a3496 2023-04-14 thomas diff -u $testroot/view.expected $testroot/view
206 b85a3496 2023-04-14 thomas test_done "$testroot" "$ret"
207 b85a3496 2023-04-14 thomas return 1
208 b85a3496 2023-04-14 thomas fi
209 b85a3496 2023-04-14 thomas
210 b85a3496 2023-04-14 thomas test_done "$testroot" "$ret"
211 b85a3496 2023-04-14 thomas }
212 b85a3496 2023-04-14 thomas
213 b85a3496 2023-04-14 thomas test_log_hsplit_ref()
214 b85a3496 2023-04-14 thomas {
215 b85a3496 2023-04-14 thomas test_init log_hsplit_ref 80 10
216 b85a3496 2023-04-14 thomas
217 b85a3496 2023-04-14 thomas local head_id=`git_show_head $testroot/repo`
218 b85a3496 2023-04-14 thomas local author_time=`git_show_author_time $testroot/repo`
219 b85a3496 2023-04-14 thomas local date=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
220 b85a3496 2023-04-14 thomas local ymd=`date -u -r $author_time +"%G-%m-%d"`
221 b85a3496 2023-04-14 thomas
222 fa9bb690 2023-04-22 thomas cat <<EOF >$TOG_TEST_SCRIPT
223 b85a3496 2023-04-14 thomas R open ref view
224 b85a3496 2023-04-14 thomas S toggle horizontal split
225 b85a3496 2023-04-14 thomas - reduce size of ref view split
226 b85a3496 2023-04-14 thomas SCREENDUMP
227 b85a3496 2023-04-14 thomas EOF
228 b85a3496 2023-04-14 thomas
229 b85a3496 2023-04-14 thomas cat <<EOF >$testroot/view.expected
230 b85a3496 2023-04-14 thomas commit $head_id [1/1] master
231 9472af95 2023-05-15 thomas $ymd flan_hacker [master] adding the test tree
232 b85a3496 2023-04-14 thomas
233 b85a3496 2023-04-14 thomas --------------------------------------------------------------------------------
234 b85a3496 2023-04-14 thomas references [1/2]
235 b85a3496 2023-04-14 thomas HEAD -> refs/heads/master
236 b85a3496 2023-04-14 thomas refs/heads/master
237 b85a3496 2023-04-14 thomas
238 b85a3496 2023-04-14 thomas
239 b85a3496 2023-04-14 thomas
240 b85a3496 2023-04-14 thomas EOF
241 b85a3496 2023-04-14 thomas
242 b85a3496 2023-04-14 thomas cd $testroot/repo && tog log
243 b85a3496 2023-04-14 thomas cmp -s $testroot/view.expected $testroot/view
244 b85a3496 2023-04-14 thomas ret=$?
245 b85a3496 2023-04-14 thomas if [ $ret -ne 0 ]; then
246 b85a3496 2023-04-14 thomas diff -u $testroot/view.expected $testroot/view
247 b85a3496 2023-04-14 thomas test_done "$testroot" "$ret"
248 b85a3496 2023-04-14 thomas return 1
249 b85a3496 2023-04-14 thomas fi
250 b85a3496 2023-04-14 thomas
251 b85a3496 2023-04-14 thomas test_done "$testroot" "$ret"
252 b85a3496 2023-04-14 thomas }
253 b85a3496 2023-04-14 thomas
254 b85a3496 2023-04-14 thomas test_log_hsplit_tree()
255 b85a3496 2023-04-14 thomas {
256 b85a3496 2023-04-14 thomas test_init log_hsplit_tree 80 10
257 b85a3496 2023-04-14 thomas
258 b85a3496 2023-04-14 thomas local head_id=`git_show_head $testroot/repo`
259 b85a3496 2023-04-14 thomas local author_time=`git_show_author_time $testroot/repo`
260 b85a3496 2023-04-14 thomas local date=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
261 b85a3496 2023-04-14 thomas local ymd=`date -u -r $author_time +"%G-%m-%d"`
262 b85a3496 2023-04-14 thomas
263 fa9bb690 2023-04-22 thomas cat <<EOF >$TOG_TEST_SCRIPT
264 b85a3496 2023-04-14 thomas T open tree view
265 b85a3496 2023-04-14 thomas S toggle horizontal split
266 b85a3496 2023-04-14 thomas j move selection cursor down one entry to "beta"
267 b85a3496 2023-04-14 thomas - reduce size of tree view split
268 b85a3496 2023-04-14 thomas SCREENDUMP
269 b85a3496 2023-04-14 thomas EOF
270 b85a3496 2023-04-14 thomas
271 b85a3496 2023-04-14 thomas cat <<EOF >$testroot/view.expected
272 b85a3496 2023-04-14 thomas commit $head_id [1/1] master
273 9472af95 2023-05-15 thomas $ymd flan_hacker [master] adding the test tree
274 b85a3496 2023-04-14 thomas
275 b85a3496 2023-04-14 thomas --------------------------------------------------------------------------------
276 b85a3496 2023-04-14 thomas commit $head_id
277 b85a3496 2023-04-14 thomas [2/4] /
278 b85a3496 2023-04-14 thomas
279 b85a3496 2023-04-14 thomas alpha
280 b85a3496 2023-04-14 thomas beta
281 b85a3496 2023-04-14 thomas epsilon/
282 b85a3496 2023-04-14 thomas EOF
283 b85a3496 2023-04-14 thomas
284 b85a3496 2023-04-14 thomas cd $testroot/repo && tog log
285 b85a3496 2023-04-14 thomas cmp -s $testroot/view.expected $testroot/view
286 b85a3496 2023-04-14 thomas ret=$?
287 b85a3496 2023-04-14 thomas if [ $ret -ne 0 ]; then
288 b85a3496 2023-04-14 thomas diff -u $testroot/view.expected $testroot/view
289 b85a3496 2023-04-14 thomas test_done "$testroot" "$ret"
290 b85a3496 2023-04-14 thomas return 1
291 b85a3496 2023-04-14 thomas fi
292 b85a3496 2023-04-14 thomas
293 b85a3496 2023-04-14 thomas test_done "$testroot" "$ret"
294 b85a3496 2023-04-14 thomas }
295 b85a3496 2023-04-14 thomas
296 b85a3496 2023-04-14 thomas test_log_logmsg_widechar()
297 b85a3496 2023-04-14 thomas {
298 b85a3496 2023-04-14 thomas # make view wide enough to fit logmsg line length
299 b85a3496 2023-04-14 thomas # but short enough so long diff lines are truncated
300 b85a3496 2023-04-14 thomas test_init log_logmsg_widechar 182 30
301 b85a3496 2023-04-14 thomas widechar_commit $testroot/repo
302 b85a3496 2023-04-14 thomas
303 b85a3496 2023-04-14 thomas local head_id=`git_show_head $testroot/repo`
304 b85a3496 2023-04-14 thomas local author_time=`git_show_author_time $testroot/repo`
305 b85a3496 2023-04-14 thomas local date=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
306 b85a3496 2023-04-14 thomas local commit1=`git_show_parent_commit $testroot/repo`
307 b85a3496 2023-04-14 thomas local blobid=`get_blob_id $testroot/repo "" $(widechar_filename)`
308 b85a3496 2023-04-14 thomas
309 fa9bb690 2023-04-22 thomas cat <<EOF >$TOG_TEST_SCRIPT
310 b85a3496 2023-04-14 thomas KEY_ENTER open selected commit in diff view
311 b85a3496 2023-04-14 thomas F toggle fullscreen
312 b85a3496 2023-04-14 thomas SCREENDUMP
313 b85a3496 2023-04-14 thomas EOF
314 b85a3496 2023-04-14 thomas
315 b85a3496 2023-04-14 thomas cat <<EOF >$testroot/view.expected
316 b85a3496 2023-04-14 thomas [1/26] diff $commit1 $head_id
317 b85a3496 2023-04-14 thomas commit $head_id (master)
318 b85a3496 2023-04-14 thomas from: Flan Hacker <flan_hacker@openbsd.org>
319 b85a3496 2023-04-14 thomas date: $date
320 b85a3496 2023-04-14 thomas
321 b85a3496 2023-04-14 thomas $(widechar_logmsg)
322 b85a3496 2023-04-14 thomas
323 b85a3496 2023-04-14 thomas A $(widechar_filename) | 5+ 0-
324 b85a3496 2023-04-14 thomas
325 b85a3496 2023-04-14 thomas 1 file changed, 5 insertions(+), 0 deletions(-)
326 b85a3496 2023-04-14 thomas
327 b85a3496 2023-04-14 thomas commit - $commit1
328 b85a3496 2023-04-14 thomas commit + $head_id
329 b85a3496 2023-04-14 thomas blob - /dev/null
330 b85a3496 2023-04-14 thomas blob + $blobid (mode 644)
331 b85a3496 2023-04-14 thomas --- /dev/null
332 b85a3496 2023-04-14 thomas +++ $(widechar_filename)
333 b85a3496 2023-04-14 thomas @@ -0,0 +1,5 @@
334 b85a3496 2023-04-14 thomas +ウィリアム・ユワート・グラッドストン(英語: William Ewart Gladstone PC FRS FSS、1809年12月29日 - 1898年5月19日)は、イギリスの政治家。
335 b85a3496 2023-04-14 thomas +
336 b85a3496 2023-04-14 thomas +ヴィクトリア朝中期から後期にかけて、自由党を指導して、4度にわたり首相を務めた。
337 b85a3496 2023-04-14 thomas +
338 b85a3496 2023-04-14 thomas +生涯を通じて敬虔なイングランド国教会の信徒であり、キリスト教の精神を政治に反映させることを目指した。多くの自由主義改革を行い、帝国主義にも批判的であった。好敵手である保守党党首ベン
339 b85a3496 2023-04-14 thomas
340 b85a3496 2023-04-14 thomas
341 b85a3496 2023-04-14 thomas
342 b85a3496 2023-04-14 thomas (END)
343 b85a3496 2023-04-14 thomas EOF
344 b85a3496 2023-04-14 thomas
345 b85a3496 2023-04-14 thomas cd $testroot/repo && tog log
346 b85a3496 2023-04-14 thomas cmp -s $testroot/view.expected $testroot/view
347 b85a3496 2023-04-14 thomas ret=$?
348 b85a3496 2023-04-14 thomas if [ $ret -ne 0 ]; then
349 b85a3496 2023-04-14 thomas diff -u $testroot/view.expected $testroot/view
350 66b04f8f 2023-07-19 thomas test_done "$testroot" "$ret"
351 66b04f8f 2023-07-19 thomas return 1
352 66b04f8f 2023-07-19 thomas fi
353 66b04f8f 2023-07-19 thomas
354 66b04f8f 2023-07-19 thomas test_done "$testroot" "$ret"
355 66b04f8f 2023-07-19 thomas }
356 66b04f8f 2023-07-19 thomas
357 66b04f8f 2023-07-19 thomas test_log_commit_keywords()
358 66b04f8f 2023-07-19 thomas {
359 66b04f8f 2023-07-19 thomas test_init log_commit_keywords 120 10
360 66b04f8f 2023-07-19 thomas local repo="$testroot/repo"
361 66b04f8f 2023-07-19 thomas local wt="$testroot/wt"
362 66b04f8f 2023-07-19 thomas local id=$(git_show_head "$repo")
363 66b04f8f 2023-07-19 thomas local author_time=$(git_show_author_time "$repo")
364 66b04f8f 2023-07-19 thomas local ymd=$(date -u -r $author_time +"%G-%m-%d")
365 66b04f8f 2023-07-19 thomas
366 8642913b 2023-07-26 thomas set -- "$id"
367 66b04f8f 2023-07-19 thomas
368 66b04f8f 2023-07-19 thomas got checkout "$repo" "$wt" > /dev/null
369 66b04f8f 2023-07-19 thomas ret=$?
370 66b04f8f 2023-07-19 thomas if [ $ret -ne 0 ]; then
371 66b04f8f 2023-07-19 thomas echo "got checkout failed unexpectedly"
372 66b04f8f 2023-07-19 thomas test_done "$testroot" "$ret"
373 66b04f8f 2023-07-19 thomas return 1
374 66b04f8f 2023-07-19 thomas fi
375 66b04f8f 2023-07-19 thomas
376 66b04f8f 2023-07-19 thomas # move into the work tree (test is run in a subshell)
377 66b04f8f 2023-07-19 thomas cd "$wt"
378 66b04f8f 2023-07-19 thomas echo -n > alpha
379 66b04f8f 2023-07-19 thomas
380 66b04f8f 2023-07-19 thomas for i in $(seq 8); do
381 66b04f8f 2023-07-19 thomas echo "alpha $i" >> alpha
382 66b04f8f 2023-07-19 thomas
383 66b04f8f 2023-07-19 thomas got ci -m "commit $i" > /dev/null
384 66b04f8f 2023-07-19 thomas ret=$?
385 66b04f8f 2023-07-19 thomas if [ $ret -ne 0 ]; then
386 66b04f8f 2023-07-19 thomas echo "commit failed unexpectedly" >&2
387 66b04f8f 2023-07-19 thomas test_done "$testroot" "$ret"
388 66b04f8f 2023-07-19 thomas return 1
389 66b04f8f 2023-07-19 thomas fi
390 66b04f8f 2023-07-19 thomas
391 66b04f8f 2023-07-19 thomas id=$(git_show_head "$repo")
392 8642913b 2023-07-26 thomas set -- "$@" "$id"
393 66b04f8f 2023-07-19 thomas done
394 66b04f8f 2023-07-19 thomas
395 66b04f8f 2023-07-19 thomas cat <<-EOF >$TOG_TEST_SCRIPT
396 92845f09 2023-07-26 thomas WAIT_FOR_UI wait for log thread to finish
397 66b04f8f 2023-07-19 thomas SCREENDUMP
398 66b04f8f 2023-07-19 thomas EOF
399 66b04f8f 2023-07-19 thomas
400 66b04f8f 2023-07-19 thomas cat <<-EOF >$testroot/view.expected
401 8642913b 2023-07-26 thomas commit $(pop_idx 5 $@) [1/5]
402 8642913b 2023-07-26 thomas $ymd $(trim_obj_id 32 $(pop_idx 5 $@)) flan_hacker commit 4
403 8642913b 2023-07-26 thomas $ymd $(trim_obj_id 32 $(pop_idx 4 $@)) flan_hacker commit 3
404 8642913b 2023-07-26 thomas $ymd $(trim_obj_id 32 $(pop_idx 3 $@)) flan_hacker commit 2
405 8642913b 2023-07-26 thomas $ymd $(trim_obj_id 32 $(pop_idx 2 $@)) flan_hacker commit 1
406 8642913b 2023-07-26 thomas $ymd $(trim_obj_id 32 $(pop_idx 1 $@)) flan_hacker adding the test tree
407 66b04f8f 2023-07-19 thomas
408 66b04f8f 2023-07-19 thomas
409 66b04f8f 2023-07-19 thomas
410 66b04f8f 2023-07-19 thomas
411 66b04f8f 2023-07-19 thomas EOF
412 66b04f8f 2023-07-19 thomas
413 66b04f8f 2023-07-19 thomas tog log -c:base:-4
414 66b04f8f 2023-07-19 thomas cmp -s "$testroot/view.expected" "$testroot/view"
415 66b04f8f 2023-07-19 thomas ret=$?
416 66b04f8f 2023-07-19 thomas if [ $ret -ne 0 ]; then
417 66b04f8f 2023-07-19 thomas diff -u "$testroot/view.expected" "$testroot/view"
418 66b04f8f 2023-07-19 thomas test_done "$testroot" "$ret"
419 66b04f8f 2023-07-19 thomas return 1
420 66b04f8f 2023-07-19 thomas fi
421 66b04f8f 2023-07-19 thomas
422 66b04f8f 2023-07-19 thomas cat <<-EOF >$testroot/view.expected
423 8642913b 2023-07-26 thomas commit $(pop_idx 7 $@) [1/7]
424 8642913b 2023-07-26 thomas $ymd $(trim_obj_id 32 $(pop_idx 7 $@)) flan_hacker commit 6
425 8642913b 2023-07-26 thomas $ymd $(trim_obj_id 32 $(pop_idx 6 $@)) flan_hacker commit 5
426 8642913b 2023-07-26 thomas $ymd $(trim_obj_id 32 $(pop_idx 5 $@)) flan_hacker commit 4
427 8642913b 2023-07-26 thomas $ymd $(trim_obj_id 32 $(pop_idx 4 $@)) flan_hacker commit 3
428 8642913b 2023-07-26 thomas $ymd $(trim_obj_id 32 $(pop_idx 3 $@)) flan_hacker commit 2
429 8642913b 2023-07-26 thomas $ymd $(trim_obj_id 32 $(pop_idx 2 $@)) flan_hacker commit 1
430 8642913b 2023-07-26 thomas $ymd $(trim_obj_id 32 $(pop_idx 1 $@)) flan_hacker adding the test tree
431 66b04f8f 2023-07-19 thomas
432 66b04f8f 2023-07-19 thomas
433 66b04f8f 2023-07-19 thomas EOF
434 66b04f8f 2023-07-19 thomas
435 66b04f8f 2023-07-19 thomas tog log -r "$repo" -c:head:-2
436 66b04f8f 2023-07-19 thomas cmp -s "$testroot/view.expected" "$testroot/view"
437 66b04f8f 2023-07-19 thomas ret=$?
438 66b04f8f 2023-07-19 thomas if [ $ret -ne 0 ]; then
439 66b04f8f 2023-07-19 thomas diff -u "$testroot/view.expected" "$testroot/view"
440 b85a3496 2023-04-14 thomas test_done "$testroot" "$ret"
441 b85a3496 2023-04-14 thomas return 1
442 b85a3496 2023-04-14 thomas fi
443 b85a3496 2023-04-14 thomas
444 66b04f8f 2023-07-19 thomas cat <<-EOF >$testroot/view.expected
445 8642913b 2023-07-26 thomas commit $(pop_idx 5 $@) [1/5]
446 8642913b 2023-07-26 thomas $ymd $(trim_obj_id 32 $(pop_idx 5 $@)) flan_hacker commit 4
447 8642913b 2023-07-26 thomas $ymd $(trim_obj_id 32 $(pop_idx 4 $@)) flan_hacker commit 3
448 8642913b 2023-07-26 thomas $ymd $(trim_obj_id 32 $(pop_idx 3 $@)) flan_hacker ~commit 2
449 8642913b 2023-07-26 thomas $ymd $(trim_obj_id 32 $(pop_idx 2 $@)) flan_hacker commit 1
450 8642913b 2023-07-26 thomas $ymd $(trim_obj_id 32 $(pop_idx 1 $@)) flan_hacker adding the test tree
451 66b04f8f 2023-07-19 thomas
452 66b04f8f 2023-07-19 thomas
453 66b04f8f 2023-07-19 thomas
454 66b04f8f 2023-07-19 thomas
455 66b04f8f 2023-07-19 thomas EOF
456 66b04f8f 2023-07-19 thomas
457 66b04f8f 2023-07-19 thomas got up -c:base:-6 > /dev/null
458 66b04f8f 2023-07-19 thomas ret=$?
459 66b04f8f 2023-07-19 thomas if [ $ret -ne 0 ]; then
460 66b04f8f 2023-07-19 thomas echo "got update failed unexpectedly"
461 66b04f8f 2023-07-19 thomas test_done "$testroot" "$ret"
462 66b04f8f 2023-07-19 thomas return 1
463 66b04f8f 2023-07-19 thomas fi
464 66b04f8f 2023-07-19 thomas
465 66b04f8f 2023-07-19 thomas tog log -c:base:+2
466 66b04f8f 2023-07-19 thomas cmp -s "$testroot/view.expected" "$testroot/view"
467 66b04f8f 2023-07-19 thomas ret=$?
468 66b04f8f 2023-07-19 thomas if [ $ret -ne 0 ]; then
469 66b04f8f 2023-07-19 thomas diff -u "$testroot/view.expected" "$testroot/view"
470 66b04f8f 2023-07-19 thomas test_done "$testroot" "$ret"
471 66b04f8f 2023-07-19 thomas return 1
472 66b04f8f 2023-07-19 thomas fi
473 66b04f8f 2023-07-19 thomas
474 66b04f8f 2023-07-19 thomas cat <<-EOF >$testroot/view.expected
475 8642913b 2023-07-26 thomas commit $(pop_idx 1 $@) [1/1]
476 8642913b 2023-07-26 thomas $ymd $(trim_obj_id 32 $(pop_idx 1 $@)) flan_hacker adding the test tree
477 66b04f8f 2023-07-19 thomas
478 66b04f8f 2023-07-19 thomas
479 66b04f8f 2023-07-19 thomas
480 66b04f8f 2023-07-19 thomas
481 66b04f8f 2023-07-19 thomas
482 66b04f8f 2023-07-19 thomas
483 66b04f8f 2023-07-19 thomas
484 66b04f8f 2023-07-19 thomas
485 66b04f8f 2023-07-19 thomas EOF
486 66b04f8f 2023-07-19 thomas
487 66b04f8f 2023-07-19 thomas tog log -c:base:-99
488 66b04f8f 2023-07-19 thomas cmp -s "$testroot/view.expected" "$testroot/view"
489 66b04f8f 2023-07-19 thomas ret=$?
490 66b04f8f 2023-07-19 thomas if [ $ret -ne 0 ]; then
491 66b04f8f 2023-07-19 thomas diff -u "$testroot/view.expected" "$testroot/view"
492 66b04f8f 2023-07-19 thomas test_done "$testroot" "$ret"
493 66b04f8f 2023-07-19 thomas return 1
494 66b04f8f 2023-07-19 thomas fi
495 66b04f8f 2023-07-19 thomas
496 b85a3496 2023-04-14 thomas test_done "$testroot" "$ret"
497 b85a3496 2023-04-14 thomas }
498 349dfd1e 2023-07-23 thomas
499 349dfd1e 2023-07-23 thomas test_log_show_base_commit()
500 349dfd1e 2023-07-23 thomas {
501 349dfd1e 2023-07-23 thomas # make view wide enough to show full headline
502 349dfd1e 2023-07-23 thomas test_init log_show_base_commit 80 3
503 349dfd1e 2023-07-23 thomas local repo="$testroot/repo"
504 349dfd1e 2023-07-23 thomas local id=$(git_show_head "$repo")
505 349dfd1e 2023-07-23 thomas
506 349dfd1e 2023-07-23 thomas echo "alpha" >> "$repo/alpha"
507 349dfd1e 2023-07-23 thomas git_commit "$repo" -m "base commit"
508 b85a3496 2023-04-14 thomas
509 349dfd1e 2023-07-23 thomas got checkout "$repo" "$testroot/wt" > /dev/null
510 349dfd1e 2023-07-23 thomas ret=$?
511 349dfd1e 2023-07-23 thomas if [ $ret -ne 0 ]; then
512 349dfd1e 2023-07-23 thomas echo "got checkout failed unexpectedly"
513 349dfd1e 2023-07-23 thomas test_done "$testroot" "$ret"
514 349dfd1e 2023-07-23 thomas return 1
515 349dfd1e 2023-07-23 thomas fi
516 349dfd1e 2023-07-23 thomas
517 349dfd1e 2023-07-23 thomas # move into the work tree (test is run in a subshell)
518 349dfd1e 2023-07-23 thomas cd "$testroot/wt"
519 349dfd1e 2023-07-23 thomas
520 349dfd1e 2023-07-23 thomas local head_id=$(git_show_head "$repo")
521 349dfd1e 2023-07-23 thomas local author_time=$(git_show_author_time "$repo")
522 349dfd1e 2023-07-23 thomas local ymd=$(date -u -r "$author_time" +"%G-%m-%d")
523 349dfd1e 2023-07-23 thomas
524 349dfd1e 2023-07-23 thomas # check up-to-date base commit marker prefixes base commit log message
525 349dfd1e 2023-07-23 thomas cat <<-EOF >$TOG_TEST_SCRIPT
526 92845f09 2023-07-26 thomas WAIT_FOR_UI wait for log thread to finish
527 349dfd1e 2023-07-23 thomas SCREENDUMP
528 349dfd1e 2023-07-23 thomas EOF
529 349dfd1e 2023-07-23 thomas
530 349dfd1e 2023-07-23 thomas cat <<-EOF >$testroot/view.expected
531 349dfd1e 2023-07-23 thomas commit $head_id [1/2] master
532 349dfd1e 2023-07-23 thomas $ymd flan_hacker *[master] base commit
533 349dfd1e 2023-07-23 thomas $ymd flan_hacker adding the test tree
534 349dfd1e 2023-07-23 thomas EOF
535 349dfd1e 2023-07-23 thomas
536 349dfd1e 2023-07-23 thomas tog log
537 349dfd1e 2023-07-23 thomas cmp -s "$testroot/view.expected" "$testroot/view"
538 349dfd1e 2023-07-23 thomas ret=$?
539 349dfd1e 2023-07-23 thomas if [ $ret -ne 0 ]; then
540 349dfd1e 2023-07-23 thomas diff -u "$testroot/view.expected" "$testroot/view"
541 349dfd1e 2023-07-23 thomas test_done "$testroot" "$ret"
542 349dfd1e 2023-07-23 thomas return 1
543 349dfd1e 2023-07-23 thomas fi
544 349dfd1e 2023-07-23 thomas
545 349dfd1e 2023-07-23 thomas # check marker is not drawn when not in a work tree
546 349dfd1e 2023-07-23 thomas cat <<-EOF >$testroot/view.expected
547 349dfd1e 2023-07-23 thomas commit $head_id [1/2] master
548 349dfd1e 2023-07-23 thomas $ymd flan_hacker [master] base commit
549 349dfd1e 2023-07-23 thomas $ymd flan_hacker adding the test tree
550 349dfd1e 2023-07-23 thomas EOF
551 349dfd1e 2023-07-23 thomas
552 349dfd1e 2023-07-23 thomas tog log -r "$repo"
553 349dfd1e 2023-07-23 thomas cmp -s "$testroot/view.expected" "$testroot/view"
554 349dfd1e 2023-07-23 thomas ret=$?
555 349dfd1e 2023-07-23 thomas if [ $ret -ne 0 ]; then
556 349dfd1e 2023-07-23 thomas diff -u "$testroot/view.expected" "$testroot/view"
557 349dfd1e 2023-07-23 thomas test_done "$testroot" "$ret"
558 349dfd1e 2023-07-23 thomas return 1
559 349dfd1e 2023-07-23 thomas fi
560 349dfd1e 2023-07-23 thomas
561 349dfd1e 2023-07-23 thomas # check out-of-date marker is shown with a mixed-commit tree
562 349dfd1e 2023-07-23 thomas echo "mixed" > alpha
563 349dfd1e 2023-07-23 thomas got commit -m "new base mixed-commit" > /dev/null
564 349dfd1e 2023-07-23 thomas head_id=$(git_show_head "$repo")
565 349dfd1e 2023-07-23 thomas
566 349dfd1e 2023-07-23 thomas cat <<-EOF >$TOG_TEST_SCRIPT
567 92845f09 2023-07-26 thomas WAIT_FOR_UI wait for log thread to finish
568 349dfd1e 2023-07-23 thomas SCREENDUMP
569 349dfd1e 2023-07-23 thomas EOF
570 349dfd1e 2023-07-23 thomas
571 349dfd1e 2023-07-23 thomas cat <<-EOF >$testroot/view.expected
572 349dfd1e 2023-07-23 thomas commit $head_id [1/3] master
573 349dfd1e 2023-07-23 thomas $ymd flan_hacker ~[master] new base mixed-commit
574 349dfd1e 2023-07-23 thomas $ymd flan_hacker base commit
575 349dfd1e 2023-07-23 thomas EOF
576 349dfd1e 2023-07-23 thomas
577 349dfd1e 2023-07-23 thomas tog log
578 349dfd1e 2023-07-23 thomas cmp -s "$testroot/view.expected" "$testroot/view"
579 349dfd1e 2023-07-23 thomas ret=$?
580 349dfd1e 2023-07-23 thomas if [ $ret -ne 0 ]; then
581 349dfd1e 2023-07-23 thomas diff -u "$testroot/view.expected" "$testroot/view"
582 349dfd1e 2023-07-23 thomas test_done "$testroot" "$ret"
583 349dfd1e 2023-07-23 thomas return 1
584 349dfd1e 2023-07-23 thomas fi
585 349dfd1e 2023-07-23 thomas
586 349dfd1e 2023-07-23 thomas test_done "$testroot" "$ret"
587 349dfd1e 2023-07-23 thomas }
588 349dfd1e 2023-07-23 thomas
589 b85a3496 2023-04-14 thomas test_parseargs "$@"
590 b85a3496 2023-04-14 thomas run_test test_log_hsplit_diff
591 b85a3496 2023-04-14 thomas run_test test_log_vsplit_diff
592 b85a3496 2023-04-14 thomas run_test test_log_show_author
593 b85a3496 2023-04-14 thomas run_test test_log_scroll_right
594 b85a3496 2023-04-14 thomas run_test test_log_hsplit_ref
595 b85a3496 2023-04-14 thomas run_test test_log_hsplit_tree
596 b85a3496 2023-04-14 thomas run_test test_log_logmsg_widechar
597 66b04f8f 2023-07-19 thomas run_test test_log_commit_keywords
598 349dfd1e 2023-07-23 thomas run_test test_log_show_base_commit