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 66b04f8f 2023-07-19 thomas set -A ids "$id"
367 66b04f8f 2023-07-19 thomas set -A short_ids "$(trim_obj_id 32 $id)"
368 66b04f8f 2023-07-19 thomas
369 66b04f8f 2023-07-19 thomas got checkout "$repo" "$wt" > /dev/null
370 66b04f8f 2023-07-19 thomas ret=$?
371 66b04f8f 2023-07-19 thomas if [ $ret -ne 0 ]; then
372 66b04f8f 2023-07-19 thomas echo "got checkout failed unexpectedly"
373 66b04f8f 2023-07-19 thomas test_done "$testroot" "$ret"
374 66b04f8f 2023-07-19 thomas return 1
375 66b04f8f 2023-07-19 thomas fi
376 66b04f8f 2023-07-19 thomas
377 66b04f8f 2023-07-19 thomas # move into the work tree (test is run in a subshell)
378 66b04f8f 2023-07-19 thomas cd "$wt"
379 66b04f8f 2023-07-19 thomas echo -n > alpha
380 66b04f8f 2023-07-19 thomas
381 66b04f8f 2023-07-19 thomas for i in $(seq 8); do
382 66b04f8f 2023-07-19 thomas echo "alpha $i" >> alpha
383 66b04f8f 2023-07-19 thomas
384 66b04f8f 2023-07-19 thomas got ci -m "commit $i" > /dev/null
385 66b04f8f 2023-07-19 thomas ret=$?
386 66b04f8f 2023-07-19 thomas if [ $ret -ne 0 ]; then
387 66b04f8f 2023-07-19 thomas echo "commit failed unexpectedly" >&2
388 66b04f8f 2023-07-19 thomas test_done "$testroot" "$ret"
389 66b04f8f 2023-07-19 thomas return 1
390 66b04f8f 2023-07-19 thomas fi
391 66b04f8f 2023-07-19 thomas
392 66b04f8f 2023-07-19 thomas id=$(git_show_head "$repo")
393 66b04f8f 2023-07-19 thomas set -- "$ids" "$id"
394 66b04f8f 2023-07-19 thomas ids=$*
395 66b04f8f 2023-07-19 thomas set -- "$short_ids" "$(trim_obj_id 32 $id)"
396 66b04f8f 2023-07-19 thomas short_ids=$*
397 66b04f8f 2023-07-19 thomas done
398 66b04f8f 2023-07-19 thomas
399 66b04f8f 2023-07-19 thomas cat <<-EOF >$TOG_TEST_SCRIPT
400 66b04f8f 2023-07-19 thomas SCREENDUMP
401 66b04f8f 2023-07-19 thomas EOF
402 66b04f8f 2023-07-19 thomas
403 66b04f8f 2023-07-19 thomas cat <<-EOF >$testroot/view.expected
404 66b04f8f 2023-07-19 thomas commit $(pop_id 5 $ids) [1/5]
405 66b04f8f 2023-07-19 thomas $ymd $(pop_id 5 $short_ids) flan_hacker commit 4
406 66b04f8f 2023-07-19 thomas $ymd $(pop_id 4 $short_ids) flan_hacker commit 3
407 66b04f8f 2023-07-19 thomas $ymd $(pop_id 3 $short_ids) flan_hacker commit 2
408 66b04f8f 2023-07-19 thomas $ymd $(pop_id 2 $short_ids) flan_hacker commit 1
409 66b04f8f 2023-07-19 thomas $ymd $(pop_id 1 $short_ids) flan_hacker adding the test tree
410 66b04f8f 2023-07-19 thomas
411 66b04f8f 2023-07-19 thomas
412 66b04f8f 2023-07-19 thomas
413 66b04f8f 2023-07-19 thomas
414 66b04f8f 2023-07-19 thomas EOF
415 66b04f8f 2023-07-19 thomas
416 66b04f8f 2023-07-19 thomas tog log -c:base:-4
417 66b04f8f 2023-07-19 thomas cmp -s "$testroot/view.expected" "$testroot/view"
418 66b04f8f 2023-07-19 thomas ret=$?
419 66b04f8f 2023-07-19 thomas if [ $ret -ne 0 ]; then
420 66b04f8f 2023-07-19 thomas diff -u "$testroot/view.expected" "$testroot/view"
421 66b04f8f 2023-07-19 thomas test_done "$testroot" "$ret"
422 66b04f8f 2023-07-19 thomas return 1
423 66b04f8f 2023-07-19 thomas fi
424 66b04f8f 2023-07-19 thomas
425 66b04f8f 2023-07-19 thomas cat <<-EOF >$testroot/view.expected
426 66b04f8f 2023-07-19 thomas commit $(pop_id 7 $ids) [1/7]
427 66b04f8f 2023-07-19 thomas $ymd $(pop_id 7 $short_ids) flan_hacker commit 6
428 66b04f8f 2023-07-19 thomas $ymd $(pop_id 6 $short_ids) flan_hacker commit 5
429 66b04f8f 2023-07-19 thomas $ymd $(pop_id 5 $short_ids) flan_hacker commit 4
430 66b04f8f 2023-07-19 thomas $ymd $(pop_id 4 $short_ids) flan_hacker commit 3
431 66b04f8f 2023-07-19 thomas $ymd $(pop_id 3 $short_ids) flan_hacker commit 2
432 66b04f8f 2023-07-19 thomas $ymd $(pop_id 2 $short_ids) flan_hacker commit 1
433 66b04f8f 2023-07-19 thomas $ymd $(pop_id 1 $short_ids) flan_hacker adding the test tree
434 66b04f8f 2023-07-19 thomas
435 66b04f8f 2023-07-19 thomas
436 66b04f8f 2023-07-19 thomas EOF
437 66b04f8f 2023-07-19 thomas
438 66b04f8f 2023-07-19 thomas tog log -r "$repo" -c:head:-2
439 66b04f8f 2023-07-19 thomas cmp -s "$testroot/view.expected" "$testroot/view"
440 66b04f8f 2023-07-19 thomas ret=$?
441 66b04f8f 2023-07-19 thomas if [ $ret -ne 0 ]; then
442 66b04f8f 2023-07-19 thomas diff -u "$testroot/view.expected" "$testroot/view"
443 b85a3496 2023-04-14 thomas test_done "$testroot" "$ret"
444 b85a3496 2023-04-14 thomas return 1
445 b85a3496 2023-04-14 thomas fi
446 b85a3496 2023-04-14 thomas
447 66b04f8f 2023-07-19 thomas cat <<-EOF >$testroot/view.expected
448 66b04f8f 2023-07-19 thomas commit $(pop_id 5 $ids) [1/5]
449 66b04f8f 2023-07-19 thomas $ymd $(pop_id 5 $short_ids) flan_hacker commit 4
450 66b04f8f 2023-07-19 thomas $ymd $(pop_id 4 $short_ids) flan_hacker commit 3
451 349dfd1e 2023-07-23 thomas $ymd $(pop_id 3 $short_ids) flan_hacker ~commit 2
452 66b04f8f 2023-07-19 thomas $ymd $(pop_id 2 $short_ids) flan_hacker commit 1
453 66b04f8f 2023-07-19 thomas $ymd $(pop_id 1 $short_ids) flan_hacker adding the test tree
454 66b04f8f 2023-07-19 thomas
455 66b04f8f 2023-07-19 thomas
456 66b04f8f 2023-07-19 thomas
457 66b04f8f 2023-07-19 thomas
458 66b04f8f 2023-07-19 thomas EOF
459 66b04f8f 2023-07-19 thomas
460 66b04f8f 2023-07-19 thomas got up -c:base:-6 > /dev/null
461 66b04f8f 2023-07-19 thomas ret=$?
462 66b04f8f 2023-07-19 thomas if [ $ret -ne 0 ]; then
463 66b04f8f 2023-07-19 thomas echo "got update failed unexpectedly"
464 66b04f8f 2023-07-19 thomas test_done "$testroot" "$ret"
465 66b04f8f 2023-07-19 thomas return 1
466 66b04f8f 2023-07-19 thomas fi
467 66b04f8f 2023-07-19 thomas
468 66b04f8f 2023-07-19 thomas tog log -c:base:+2
469 66b04f8f 2023-07-19 thomas cmp -s "$testroot/view.expected" "$testroot/view"
470 66b04f8f 2023-07-19 thomas ret=$?
471 66b04f8f 2023-07-19 thomas if [ $ret -ne 0 ]; then
472 66b04f8f 2023-07-19 thomas diff -u "$testroot/view.expected" "$testroot/view"
473 66b04f8f 2023-07-19 thomas test_done "$testroot" "$ret"
474 66b04f8f 2023-07-19 thomas return 1
475 66b04f8f 2023-07-19 thomas fi
476 66b04f8f 2023-07-19 thomas
477 66b04f8f 2023-07-19 thomas cat <<-EOF >$testroot/view.expected
478 66b04f8f 2023-07-19 thomas commit $(pop_id 1 $ids) [1/1]
479 66b04f8f 2023-07-19 thomas $ymd $(pop_id 1 $short_ids) flan_hacker adding the test tree
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
486 66b04f8f 2023-07-19 thomas
487 66b04f8f 2023-07-19 thomas
488 66b04f8f 2023-07-19 thomas EOF
489 66b04f8f 2023-07-19 thomas
490 66b04f8f 2023-07-19 thomas tog log -c:base:-99
491 66b04f8f 2023-07-19 thomas cmp -s "$testroot/view.expected" "$testroot/view"
492 66b04f8f 2023-07-19 thomas ret=$?
493 66b04f8f 2023-07-19 thomas if [ $ret -ne 0 ]; then
494 66b04f8f 2023-07-19 thomas diff -u "$testroot/view.expected" "$testroot/view"
495 66b04f8f 2023-07-19 thomas test_done "$testroot" "$ret"
496 66b04f8f 2023-07-19 thomas return 1
497 66b04f8f 2023-07-19 thomas fi
498 66b04f8f 2023-07-19 thomas
499 b85a3496 2023-04-14 thomas test_done "$testroot" "$ret"
500 b85a3496 2023-04-14 thomas }
501 349dfd1e 2023-07-23 thomas
502 349dfd1e 2023-07-23 thomas test_log_show_base_commit()
503 349dfd1e 2023-07-23 thomas {
504 349dfd1e 2023-07-23 thomas # make view wide enough to show full headline
505 349dfd1e 2023-07-23 thomas test_init log_show_base_commit 80 3
506 349dfd1e 2023-07-23 thomas local repo="$testroot/repo"
507 349dfd1e 2023-07-23 thomas local id=$(git_show_head "$repo")
508 349dfd1e 2023-07-23 thomas
509 349dfd1e 2023-07-23 thomas echo "alpha" >> "$repo/alpha"
510 349dfd1e 2023-07-23 thomas git_commit "$repo" -m "base commit"
511 b85a3496 2023-04-14 thomas
512 349dfd1e 2023-07-23 thomas got checkout "$repo" "$testroot/wt" > /dev/null
513 349dfd1e 2023-07-23 thomas ret=$?
514 349dfd1e 2023-07-23 thomas if [ $ret -ne 0 ]; then
515 349dfd1e 2023-07-23 thomas echo "got checkout failed unexpectedly"
516 349dfd1e 2023-07-23 thomas test_done "$testroot" "$ret"
517 349dfd1e 2023-07-23 thomas return 1
518 349dfd1e 2023-07-23 thomas fi
519 349dfd1e 2023-07-23 thomas
520 349dfd1e 2023-07-23 thomas # move into the work tree (test is run in a subshell)
521 349dfd1e 2023-07-23 thomas cd "$testroot/wt"
522 349dfd1e 2023-07-23 thomas
523 349dfd1e 2023-07-23 thomas local head_id=$(git_show_head "$repo")
524 349dfd1e 2023-07-23 thomas local author_time=$(git_show_author_time "$repo")
525 349dfd1e 2023-07-23 thomas local ymd=$(date -u -r "$author_time" +"%G-%m-%d")
526 349dfd1e 2023-07-23 thomas
527 349dfd1e 2023-07-23 thomas # check up-to-date base commit marker prefixes base commit log message
528 349dfd1e 2023-07-23 thomas cat <<-EOF >$TOG_TEST_SCRIPT
529 349dfd1e 2023-07-23 thomas SCREENDUMP
530 349dfd1e 2023-07-23 thomas EOF
531 349dfd1e 2023-07-23 thomas
532 349dfd1e 2023-07-23 thomas cat <<-EOF >$testroot/view.expected
533 349dfd1e 2023-07-23 thomas commit $head_id [1/2] master
534 349dfd1e 2023-07-23 thomas $ymd flan_hacker *[master] base commit
535 349dfd1e 2023-07-23 thomas $ymd flan_hacker adding the test tree
536 349dfd1e 2023-07-23 thomas EOF
537 349dfd1e 2023-07-23 thomas
538 349dfd1e 2023-07-23 thomas tog log
539 349dfd1e 2023-07-23 thomas cmp -s "$testroot/view.expected" "$testroot/view"
540 349dfd1e 2023-07-23 thomas ret=$?
541 349dfd1e 2023-07-23 thomas if [ $ret -ne 0 ]; then
542 349dfd1e 2023-07-23 thomas diff -u "$testroot/view.expected" "$testroot/view"
543 349dfd1e 2023-07-23 thomas test_done "$testroot" "$ret"
544 349dfd1e 2023-07-23 thomas return 1
545 349dfd1e 2023-07-23 thomas fi
546 349dfd1e 2023-07-23 thomas
547 349dfd1e 2023-07-23 thomas # check marker is not drawn when not in a work tree
548 349dfd1e 2023-07-23 thomas cat <<-EOF >$testroot/view.expected
549 349dfd1e 2023-07-23 thomas commit $head_id [1/2] master
550 349dfd1e 2023-07-23 thomas $ymd flan_hacker [master] base commit
551 349dfd1e 2023-07-23 thomas $ymd flan_hacker adding the test tree
552 349dfd1e 2023-07-23 thomas EOF
553 349dfd1e 2023-07-23 thomas
554 349dfd1e 2023-07-23 thomas tog log -r "$repo"
555 349dfd1e 2023-07-23 thomas cmp -s "$testroot/view.expected" "$testroot/view"
556 349dfd1e 2023-07-23 thomas ret=$?
557 349dfd1e 2023-07-23 thomas if [ $ret -ne 0 ]; then
558 349dfd1e 2023-07-23 thomas diff -u "$testroot/view.expected" "$testroot/view"
559 349dfd1e 2023-07-23 thomas test_done "$testroot" "$ret"
560 349dfd1e 2023-07-23 thomas return 1
561 349dfd1e 2023-07-23 thomas fi
562 349dfd1e 2023-07-23 thomas
563 349dfd1e 2023-07-23 thomas # check out-of-date marker is shown with a mixed-commit tree
564 349dfd1e 2023-07-23 thomas echo "mixed" > alpha
565 349dfd1e 2023-07-23 thomas got commit -m "new base mixed-commit" > /dev/null
566 349dfd1e 2023-07-23 thomas head_id=$(git_show_head "$repo")
567 349dfd1e 2023-07-23 thomas
568 349dfd1e 2023-07-23 thomas cat <<-EOF >$TOG_TEST_SCRIPT
569 349dfd1e 2023-07-23 thomas SCREENDUMP
570 349dfd1e 2023-07-23 thomas EOF
571 349dfd1e 2023-07-23 thomas
572 349dfd1e 2023-07-23 thomas cat <<-EOF >$testroot/view.expected
573 349dfd1e 2023-07-23 thomas commit $head_id [1/3] master
574 349dfd1e 2023-07-23 thomas $ymd flan_hacker ~[master] new base mixed-commit
575 349dfd1e 2023-07-23 thomas $ymd flan_hacker base commit
576 349dfd1e 2023-07-23 thomas EOF
577 349dfd1e 2023-07-23 thomas
578 349dfd1e 2023-07-23 thomas tog log
579 349dfd1e 2023-07-23 thomas cmp -s "$testroot/view.expected" "$testroot/view"
580 349dfd1e 2023-07-23 thomas ret=$?
581 349dfd1e 2023-07-23 thomas if [ $ret -ne 0 ]; then
582 349dfd1e 2023-07-23 thomas diff -u "$testroot/view.expected" "$testroot/view"
583 349dfd1e 2023-07-23 thomas test_done "$testroot" "$ret"
584 349dfd1e 2023-07-23 thomas return 1
585 349dfd1e 2023-07-23 thomas fi
586 349dfd1e 2023-07-23 thomas
587 349dfd1e 2023-07-23 thomas test_done "$testroot" "$ret"
588 349dfd1e 2023-07-23 thomas }
589 349dfd1e 2023-07-23 thomas
590 b85a3496 2023-04-14 thomas test_parseargs "$@"
591 b85a3496 2023-04-14 thomas run_test test_log_hsplit_diff
592 b85a3496 2023-04-14 thomas run_test test_log_vsplit_diff
593 b85a3496 2023-04-14 thomas run_test test_log_show_author
594 b85a3496 2023-04-14 thomas run_test test_log_scroll_right
595 b85a3496 2023-04-14 thomas run_test test_log_hsplit_ref
596 b85a3496 2023-04-14 thomas run_test test_log_hsplit_tree
597 b85a3496 2023-04-14 thomas run_test test_log_logmsg_widechar
598 66b04f8f 2023-07-19 thomas run_test test_log_commit_keywords
599 349dfd1e 2023-07-23 thomas run_test test_log_show_base_commit