Blame


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