3 a129376b 2019-03-28 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
5 a129376b 2019-03-28 stsp # Permission to use, copy, modify, and distribute this software for any
6 a129376b 2019-03-28 stsp # purpose with or without fee is hereby granted, provided that the above
7 a129376b 2019-03-28 stsp # copyright notice and this permission notice appear in all copies.
9 a129376b 2019-03-28 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 a129376b 2019-03-28 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 a129376b 2019-03-28 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 a129376b 2019-03-28 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 a129376b 2019-03-28 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 a129376b 2019-03-28 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 a129376b 2019-03-28 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 a129376b 2019-03-28 stsp . ./common.sh
19 f6cae3ed 2020-09-13 naddy test_revert_basic() {
20 a129376b 2019-03-28 stsp local testroot=`test_init revert_basic`
22 a129376b 2019-03-28 stsp got checkout $testroot/repo $testroot/wt > /dev/null
24 a129376b 2019-03-28 stsp if [ "$ret" != "0" ]; then
25 a129376b 2019-03-28 stsp test_done "$testroot" "$ret"
29 5e54fb30 2019-05-31 stsp echo "modified epsilon/zeta" > $testroot/wt/epsilon/zeta
31 5e54fb30 2019-05-31 stsp echo 'R epsilon/zeta' > $testroot/stdout.expected
33 5e54fb30 2019-05-31 stsp (cd $testroot/wt && got revert epsilon/zeta > $testroot/stdout)
35 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
37 a129376b 2019-03-28 stsp if [ "$ret" != "0" ]; then
38 a129376b 2019-03-28 stsp diff -u $testroot/stdout.expected $testroot/stdout
39 a129376b 2019-03-28 stsp test_done "$testroot" "$ret"
43 5e54fb30 2019-05-31 stsp echo "zeta" > $testroot/content.expected
44 5e54fb30 2019-05-31 stsp cat $testroot/wt/epsilon/zeta > $testroot/content
46 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
48 a129376b 2019-03-28 stsp if [ "$ret" != "0" ]; then
49 a129376b 2019-03-28 stsp diff -u $testroot/content.expected $testroot/content
51 a129376b 2019-03-28 stsp test_done "$testroot" "$ret"
55 f6cae3ed 2020-09-13 naddy test_revert_rm() {
56 a129376b 2019-03-28 stsp local testroot=`test_init revert_rm`
58 a129376b 2019-03-28 stsp got checkout $testroot/repo $testroot/wt > /dev/null
60 a129376b 2019-03-28 stsp if [ "$ret" != "0" ]; then
61 a129376b 2019-03-28 stsp test_done "$testroot" "$ret"
65 a129376b 2019-03-28 stsp (cd $testroot/wt && got rm beta >/dev/null)
67 a129376b 2019-03-28 stsp echo 'R beta' > $testroot/stdout.expected
69 a129376b 2019-03-28 stsp (cd $testroot/wt && got revert beta > $testroot/stdout)
71 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
73 a129376b 2019-03-28 stsp if [ "$ret" != "0" ]; then
74 a129376b 2019-03-28 stsp diff -u $testroot/stdout.expected $testroot/stdout
75 a129376b 2019-03-28 stsp test_done "$testroot" "$ret"
79 a129376b 2019-03-28 stsp echo "beta" > $testroot/content.expected
80 a129376b 2019-03-28 stsp cat $testroot/wt/beta > $testroot/content
82 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
84 a129376b 2019-03-28 stsp if [ "$ret" != "0" ]; then
85 a129376b 2019-03-28 stsp diff -u $testroot/content.expected $testroot/content
87 a129376b 2019-03-28 stsp test_done "$testroot" "$ret"
90 f6cae3ed 2020-09-13 naddy test_revert_add() {
91 a129376b 2019-03-28 stsp local testroot=`test_init revert_add`
93 a129376b 2019-03-28 stsp got checkout $testroot/repo $testroot/wt > /dev/null
95 a129376b 2019-03-28 stsp if [ "$ret" != "0" ]; then
96 a129376b 2019-03-28 stsp test_done "$testroot" "$ret"
100 a129376b 2019-03-28 stsp echo "new file" > $testroot/wt/new
101 a129376b 2019-03-28 stsp (cd $testroot/wt && got add new >/dev/null)
103 a129376b 2019-03-28 stsp echo 'R new' > $testroot/stdout.expected
105 a129376b 2019-03-28 stsp (cd $testroot/wt && got revert new > $testroot/stdout)
107 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
109 a129376b 2019-03-28 stsp if [ "$ret" != "0" ]; then
110 a129376b 2019-03-28 stsp diff -u $testroot/stdout.expected $testroot/stdout
111 a129376b 2019-03-28 stsp test_done "$testroot" "$ret"
115 a129376b 2019-03-28 stsp echo "new file" > $testroot/content.expected
116 a129376b 2019-03-28 stsp cat $testroot/wt/new > $testroot/content
118 8d301dd9 2019-05-14 stsp cmp -s $testroot/content.expected $testroot/content
120 a129376b 2019-03-28 stsp if [ "$ret" != "0" ]; then
121 a129376b 2019-03-28 stsp diff -u $testroot/content.expected $testroot/content
122 a129376b 2019-03-28 stsp test_done "$testroot" "$ret"
126 a129376b 2019-03-28 stsp echo '? new' > $testroot/stdout.expected
128 a129376b 2019-03-28 stsp (cd $testroot/wt && got status > $testroot/stdout)
130 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
132 a129376b 2019-03-28 stsp if [ "$ret" != "0" ]; then
133 a129376b 2019-03-28 stsp diff -u $testroot/stdout.expected $testroot/stdout
135 a129376b 2019-03-28 stsp test_done "$testroot" "$ret"
138 f6cae3ed 2020-09-13 naddy test_revert_multiple() {
139 e20a8b6f 2019-06-04 stsp local testroot=`test_init revert_multiple`
141 e20a8b6f 2019-06-04 stsp got checkout $testroot/repo $testroot/wt > /dev/null
143 e20a8b6f 2019-06-04 stsp if [ "$ret" != "0" ]; then
144 e20a8b6f 2019-06-04 stsp test_done "$testroot" "$ret"
148 e20a8b6f 2019-06-04 stsp echo "modified alpha" > $testroot/wt/alpha
149 e20a8b6f 2019-06-04 stsp echo "modified epsilon/zeta" > $testroot/wt/epsilon/zeta
151 e20a8b6f 2019-06-04 stsp echo 'R alpha' > $testroot/stdout.expected
152 e20a8b6f 2019-06-04 stsp echo 'R epsilon/zeta' >> $testroot/stdout.expected
154 e20a8b6f 2019-06-04 stsp (cd $testroot/wt && got revert alpha epsilon/zeta > $testroot/stdout)
156 e20a8b6f 2019-06-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
158 e20a8b6f 2019-06-04 stsp if [ "$ret" != "0" ]; then
159 e20a8b6f 2019-06-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
160 e20a8b6f 2019-06-04 stsp test_done "$testroot" "$ret"
164 e20a8b6f 2019-06-04 stsp echo "alpha" > $testroot/content.expected
165 e20a8b6f 2019-06-04 stsp cat $testroot/wt/alpha > $testroot/content
167 e20a8b6f 2019-06-04 stsp cmp -s $testroot/content.expected $testroot/content
169 e20a8b6f 2019-06-04 stsp if [ "$ret" != "0" ]; then
170 e20a8b6f 2019-06-04 stsp diff -u $testroot/content.expected $testroot/content
171 e20a8b6f 2019-06-04 stsp test_done "$testroot" "$ret"
175 e20a8b6f 2019-06-04 stsp echo "zeta" > $testroot/content.expected
176 e20a8b6f 2019-06-04 stsp cat $testroot/wt/epsilon/zeta > $testroot/content
178 e20a8b6f 2019-06-04 stsp cmp -s $testroot/content.expected $testroot/content
180 e20a8b6f 2019-06-04 stsp if [ "$ret" != "0" ]; then
181 e20a8b6f 2019-06-04 stsp diff -u $testroot/content.expected $testroot/content
183 e20a8b6f 2019-06-04 stsp test_done "$testroot" "$ret"
186 f6cae3ed 2020-09-13 naddy test_revert_file_in_new_subdir() {
187 a9fa2909 2019-07-27 stsp local testroot=`test_init revert_file_in_new_subdir`
189 a9fa2909 2019-07-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
191 a9fa2909 2019-07-27 stsp if [ "$ret" != "0" ]; then
192 a9fa2909 2019-07-27 stsp test_done "$testroot" "$ret"
197 a9fa2909 2019-07-27 stsp mkdir -p $testroot/wt/newdir
198 a9fa2909 2019-07-27 stsp echo new > $testroot/wt/newdir/new
199 a9fa2909 2019-07-27 stsp (cd $testroot/wt && got add newdir/new > /dev/null)
201 a9fa2909 2019-07-27 stsp (cd $testroot/wt && got revert newdir/new > $testroot/stdout)
203 a9fa2909 2019-07-27 stsp echo "R newdir/new" > $testroot/stdout.expected
204 a9fa2909 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
206 a9fa2909 2019-07-27 stsp if [ "$ret" != "0" ]; then
207 a9fa2909 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
208 a9fa2909 2019-07-27 stsp test_done "$testroot" "$ret"
212 a9fa2909 2019-07-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
214 a9fa2909 2019-07-27 stsp echo "? newdir/new" > $testroot/stdout.expected
215 a9fa2909 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
217 a9fa2909 2019-07-27 stsp if [ "$ret" != "0" ]; then
218 a9fa2909 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
220 a9fa2909 2019-07-27 stsp test_done "$testroot" "$ret"
224 f6cae3ed 2020-09-13 naddy test_revert_no_arguments() {
225 1f1abb7e 2019-08-08 stsp local testroot=`test_init revert_no_arguments`
227 1f1abb7e 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
229 1f1abb7e 2019-08-08 stsp if [ "$ret" != "0" ]; then
230 1f1abb7e 2019-08-08 stsp test_done "$testroot" "$ret"
234 1f1abb7e 2019-08-08 stsp echo "modified epsilon/zeta" > $testroot/wt/epsilon/zeta
236 1f1abb7e 2019-08-08 stsp (cd $testroot/wt && got revert > $testroot/stdout 2> $testroot/stderr)
238 54c39596 2020-12-28 stsp if [ "$ret" = "0" ]; then
239 1f1abb7e 2019-08-08 stsp echo "revert command succeeded unexpectedly" >&2
240 1f1abb7e 2019-08-08 stsp test_done "$testroot" "1"
244 1f1abb7e 2019-08-08 stsp echo -n > $testroot/stdout.expected
245 1f1abb7e 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
247 1f1abb7e 2019-08-08 stsp if [ "$ret" != "0" ]; then
248 1f1abb7e 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
249 1f1abb7e 2019-08-08 stsp test_done "$testroot" "$ret"
253 33aa809d 2019-08-08 stsp echo "usage: got revert [-p] [-F response-script] [-R] path ..." \
254 33aa809d 2019-08-08 stsp > $testroot/stderr.expected
255 0f6d7415 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
257 0f6d7415 2019-08-08 stsp if [ "$ret" != "0" ]; then
258 0f6d7415 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
260 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
263 f6cae3ed 2020-09-13 naddy test_revert_directory() {
264 0f6d7415 2019-08-08 stsp local testroot=`test_init revert_directory`
266 0f6d7415 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
268 0f6d7415 2019-08-08 stsp if [ "$ret" != "0" ]; then
269 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
273 0f6d7415 2019-08-08 stsp echo "modified epsilon/zeta" > $testroot/wt/epsilon/zeta
275 0f6d7415 2019-08-08 stsp (cd $testroot/wt && got revert . > $testroot/stdout 2> $testroot/stderr)
277 54c39596 2020-12-28 stsp if [ "$ret" = "0" ]; then
278 0f6d7415 2019-08-08 stsp echo "got revert command succeeded unexpectedly" >&2
279 0f6d7415 2019-08-08 stsp test_done "$testroot" "1"
282 0f6d7415 2019-08-08 stsp echo "got: reverting directories requires -R option" \
283 0f6d7415 2019-08-08 stsp > $testroot/stderr.expected
284 1f1abb7e 2019-08-08 stsp cmp -s $testroot/stderr.expected $testroot/stderr
286 1f1abb7e 2019-08-08 stsp if [ "$ret" != "0" ]; then
287 1f1abb7e 2019-08-08 stsp diff -u $testroot/stderr.expected $testroot/stderr
288 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
292 0f6d7415 2019-08-08 stsp echo -n > $testroot/stdout.expected
293 0f6d7415 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
295 0f6d7415 2019-08-08 stsp if [ "$ret" != "0" ]; then
296 0f6d7415 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
297 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
301 0f6d7415 2019-08-08 stsp (cd $testroot/wt && got revert -R . > $testroot/stdout)
303 0f6d7415 2019-08-08 stsp echo 'R epsilon/zeta' > $testroot/stdout.expected
304 0f6d7415 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
306 0f6d7415 2019-08-08 stsp if [ "$ret" != "0" ]; then
307 0f6d7415 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
308 0f6d7415 2019-08-08 stsp test_done "$testroot" "$ret"
312 0f6d7415 2019-08-08 stsp echo "zeta" > $testroot/content.expected
313 0f6d7415 2019-08-08 stsp cat $testroot/wt/epsilon/zeta > $testroot/content
315 0f6d7415 2019-08-08 stsp cmp -s $testroot/content.expected $testroot/content
317 0f6d7415 2019-08-08 stsp if [ "$ret" != "0" ]; then
318 0f6d7415 2019-08-08 stsp diff -u $testroot/content.expected $testroot/content
320 33aa809d 2019-08-08 stsp test_done "$testroot" "$ret"
323 f6cae3ed 2020-09-13 naddy test_revert_directory_unknown() {
324 3d69ad8d 2019-08-17 semarie local testroot=`test_init revert_directory_unknown`
326 3d69ad8d 2019-08-17 semarie got checkout $testroot/repo $testroot/wt > /dev/null
327 3d69ad8d 2019-08-17 semarie ret="$?"
328 3d69ad8d 2019-08-17 semarie if [ "$ret" != "0" ]; then
329 3d69ad8d 2019-08-17 semarie test_done "$testroot" "$ret"
330 3d69ad8d 2019-08-17 semarie return 1
333 3d69ad8d 2019-08-17 semarie echo "modified alpha" > $testroot/wt/alpha
334 3d69ad8d 2019-08-17 semarie echo "new untracked file" > $testroot/wt/epsilon/new_file
335 6a5eff7c 2019-11-23 stsp echo "modified epsilon/zeta" > $testroot/wt/epsilon/zeta
337 3d69ad8d 2019-08-17 semarie (cd $testroot/wt && got revert -R . > $testroot/stdout)
339 3d69ad8d 2019-08-17 semarie echo 'R alpha' > $testroot/stdout.expected
340 3d69ad8d 2019-08-17 semarie echo 'R epsilon/zeta' >> $testroot/stdout.expected
341 3d69ad8d 2019-08-17 semarie cmp -s $testroot/stdout.expected $testroot/stdout
342 3d69ad8d 2019-08-17 semarie ret="$?"
343 3d69ad8d 2019-08-17 semarie if [ "$ret" != "0" ]; then
344 3d69ad8d 2019-08-17 semarie diff -u $testroot/stdout.expected $testroot/stdout
345 3d69ad8d 2019-08-17 semarie test_done "$testroot" "$ret"
346 3d69ad8d 2019-08-17 semarie return 1
349 3d69ad8d 2019-08-17 semarie echo "new untracked file" > $testroot/content.expected
350 3d69ad8d 2019-08-17 semarie cat $testroot/wt/epsilon/new_file > $testroot/content
352 3d69ad8d 2019-08-17 semarie cmp -s $testroot/content.expected $testroot/content
353 3d69ad8d 2019-08-17 semarie ret="$?"
354 3d69ad8d 2019-08-17 semarie if [ "$ret" != "0" ]; then
355 3d69ad8d 2019-08-17 semarie diff -u $testroot/content.expected $testroot/content
356 3d69ad8d 2019-08-17 semarie test_done "$testroot" "$ret"
357 3d69ad8d 2019-08-17 semarie return 1
360 3d69ad8d 2019-08-17 semarie echo "zeta" > $testroot/content.expected
361 3d69ad8d 2019-08-17 semarie cat $testroot/wt/epsilon/zeta > $testroot/content
363 3d69ad8d 2019-08-17 semarie cmp -s $testroot/content.expected $testroot/content
364 3d69ad8d 2019-08-17 semarie ret="$?"
365 3d69ad8d 2019-08-17 semarie if [ "$ret" != "0" ]; then
366 3d69ad8d 2019-08-17 semarie diff -u $testroot/content.expected $testroot/content
369 3d69ad8d 2019-08-17 semarie test_done "$testroot" "$ret"
372 f6cae3ed 2020-09-13 naddy test_revert_patch() {
373 33aa809d 2019-08-08 stsp local testroot=`test_init revert_patch`
375 33aa809d 2019-08-08 stsp jot 16 > $testroot/repo/numbers
376 33aa809d 2019-08-08 stsp (cd $testroot/repo && git add numbers)
377 33aa809d 2019-08-08 stsp git_commit $testroot/repo -m "added numbers file"
378 33aa809d 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
380 33aa809d 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
382 33aa809d 2019-08-08 stsp if [ "$ret" != "0" ]; then
383 33aa809d 2019-08-08 stsp test_done "$testroot" "$ret"
387 33aa809d 2019-08-08 stsp sed -i -e 's/^2$/a/' $testroot/wt/numbers
388 33aa809d 2019-08-08 stsp sed -i -e 's/^7$/b/' $testroot/wt/numbers
389 33aa809d 2019-08-08 stsp sed -i -e 's/^16$/c/' $testroot/wt/numbers
391 33aa809d 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/numbers.diff)
393 33aa809d 2019-08-08 stsp # don't revert any hunks
394 33aa809d 2019-08-08 stsp printf "n\nn\nn\n" > $testroot/patchscript
395 33aa809d 2019-08-08 stsp (cd $testroot/wt && got revert -F $testroot/patchscript -p \
396 33aa809d 2019-08-08 stsp numbers > $testroot/stdout)
398 33aa809d 2019-08-08 stsp if [ "$ret" != "0" ]; then
399 33aa809d 2019-08-08 stsp echo "got revert command failed unexpectedly" >&2
400 33aa809d 2019-08-08 stsp test_done "$testroot" "1"
403 33aa809d 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
404 33aa809d 2019-08-08 stsp -----------------------------------------------
405 33aa809d 2019-08-08 stsp @@ -1,5 +1,5 @@
412 33aa809d 2019-08-08 stsp -----------------------------------------------
413 33aa809d 2019-08-08 stsp M numbers (change 1 of 3)
414 33aa809d 2019-08-08 stsp revert this change? [y/n/q] n
415 33aa809d 2019-08-08 stsp -----------------------------------------------
416 33aa809d 2019-08-08 stsp @@ -4,7 +4,7 @@
425 33aa809d 2019-08-08 stsp -----------------------------------------------
426 33aa809d 2019-08-08 stsp M numbers (change 2 of 3)
427 33aa809d 2019-08-08 stsp revert this change? [y/n/q] n
428 33aa809d 2019-08-08 stsp -----------------------------------------------
429 33aa809d 2019-08-08 stsp @@ -13,4 +13,4 @@
435 33aa809d 2019-08-08 stsp -----------------------------------------------
436 33aa809d 2019-08-08 stsp M numbers (change 3 of 3)
437 33aa809d 2019-08-08 stsp revert this change? [y/n/q] n
439 33aa809d 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
441 33aa809d 2019-08-08 stsp if [ "$ret" != "0" ]; then
442 33aa809d 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
443 33aa809d 2019-08-08 stsp test_done "$testroot" "$ret"
447 33aa809d 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
448 33aa809d 2019-08-08 stsp echo "M numbers" > $testroot/stdout.expected
449 33aa809d 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
451 33aa809d 2019-08-08 stsp if [ "$ret" != "0" ]; then
452 33aa809d 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
453 33aa809d 2019-08-08 stsp test_done "$testroot" "$ret"
457 33aa809d 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/stdout)
458 33aa809d 2019-08-08 stsp cmp -s $testroot/numbers.diff $testroot/stdout
460 33aa809d 2019-08-08 stsp if [ "$ret" != "0" ]; then
461 33aa809d 2019-08-08 stsp diff -u $testroot/numbers.diff $testroot/stdout
462 33aa809d 2019-08-08 stsp test_done "$testroot" "$ret"
466 ce2b05c7 2019-08-10 stsp # revert first hunk
467 ce2b05c7 2019-08-10 stsp printf "y\nn\nn\n" > $testroot/patchscript
468 ce2b05c7 2019-08-10 stsp (cd $testroot/wt && got revert -F $testroot/patchscript -p \
469 ce2b05c7 2019-08-10 stsp numbers > $testroot/stdout)
471 ce2b05c7 2019-08-10 stsp if [ "$ret" != "0" ]; then
472 ce2b05c7 2019-08-10 stsp echo "got revert command failed unexpectedly" >&2
473 ce2b05c7 2019-08-10 stsp test_done "$testroot" "1"
476 ce2b05c7 2019-08-10 stsp cat > $testroot/stdout.expected <<EOF
477 ce2b05c7 2019-08-10 stsp -----------------------------------------------
478 ce2b05c7 2019-08-10 stsp @@ -1,5 +1,5 @@
485 ce2b05c7 2019-08-10 stsp -----------------------------------------------
486 ce2b05c7 2019-08-10 stsp M numbers (change 1 of 3)
487 ce2b05c7 2019-08-10 stsp revert this change? [y/n/q] y
488 ce2b05c7 2019-08-10 stsp -----------------------------------------------
489 ce2b05c7 2019-08-10 stsp @@ -4,7 +4,7 @@
498 ce2b05c7 2019-08-10 stsp -----------------------------------------------
499 ce2b05c7 2019-08-10 stsp M numbers (change 2 of 3)
500 ce2b05c7 2019-08-10 stsp revert this change? [y/n/q] n
501 ce2b05c7 2019-08-10 stsp -----------------------------------------------
502 ce2b05c7 2019-08-10 stsp @@ -13,4 +13,4 @@
508 ce2b05c7 2019-08-10 stsp -----------------------------------------------
509 ce2b05c7 2019-08-10 stsp M numbers (change 3 of 3)
510 ce2b05c7 2019-08-10 stsp revert this change? [y/n/q] n
512 ce2b05c7 2019-08-10 stsp cmp -s $testroot/stdout.expected $testroot/stdout
514 ce2b05c7 2019-08-10 stsp if [ "$ret" != "0" ]; then
515 ce2b05c7 2019-08-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
516 ce2b05c7 2019-08-10 stsp test_done "$testroot" "$ret"
520 ce2b05c7 2019-08-10 stsp (cd $testroot/wt && got status > $testroot/stdout)
521 ce2b05c7 2019-08-10 stsp echo "M numbers" > $testroot/stdout.expected
522 ce2b05c7 2019-08-10 stsp cmp -s $testroot/stdout.expected $testroot/stdout
524 ce2b05c7 2019-08-10 stsp if [ "$ret" != "0" ]; then
525 ce2b05c7 2019-08-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
526 ce2b05c7 2019-08-10 stsp test_done "$testroot" "$ret"
530 ce2b05c7 2019-08-10 stsp echo "diff $commit_id $testroot/wt" > $testroot/stdout.expected
531 ce2b05c7 2019-08-10 stsp echo -n 'blob - ' >> $testroot/stdout.expected
532 ce2b05c7 2019-08-10 stsp got tree -r $testroot/repo -i -c $commit_id \
533 ce2b05c7 2019-08-10 stsp | grep 'numbers$' | cut -d' ' -f 1 \
534 ce2b05c7 2019-08-10 stsp >> $testroot/stdout.expected
535 ce2b05c7 2019-08-10 stsp echo 'file + numbers' >> $testroot/stdout.expected
536 ce2b05c7 2019-08-10 stsp cat >> $testroot/stdout.expected <<EOF
537 ce2b05c7 2019-08-10 stsp --- numbers
538 ce2b05c7 2019-08-10 stsp +++ numbers
539 ce2b05c7 2019-08-10 stsp @@ -4,7 +4,7 @@
548 ce2b05c7 2019-08-10 stsp @@ -13,4 +13,4 @@
555 ce2b05c7 2019-08-10 stsp (cd $testroot/wt && got diff > $testroot/stdout)
556 ce2b05c7 2019-08-10 stsp cmp -s $testroot/stdout.expected $testroot/stdout
558 ce2b05c7 2019-08-10 stsp if [ "$ret" != "0" ]; then
559 ce2b05c7 2019-08-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
560 ce2b05c7 2019-08-10 stsp test_done "$testroot" "$ret"
564 ce2b05c7 2019-08-10 stsp # put first hunk back
565 ce2b05c7 2019-08-10 stsp sed -i -e 's/^2$/a/' $testroot/wt/numbers
567 33aa809d 2019-08-08 stsp # revert middle hunk
568 33aa809d 2019-08-08 stsp printf "n\ny\nn\n" > $testroot/patchscript
569 33aa809d 2019-08-08 stsp (cd $testroot/wt && got revert -F $testroot/patchscript -p \
570 33aa809d 2019-08-08 stsp numbers > $testroot/stdout)
572 33aa809d 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
573 33aa809d 2019-08-08 stsp -----------------------------------------------
574 33aa809d 2019-08-08 stsp @@ -1,5 +1,5 @@
581 33aa809d 2019-08-08 stsp -----------------------------------------------
582 33aa809d 2019-08-08 stsp M numbers (change 1 of 3)
583 33aa809d 2019-08-08 stsp revert this change? [y/n/q] n
584 33aa809d 2019-08-08 stsp -----------------------------------------------
585 33aa809d 2019-08-08 stsp @@ -4,7 +4,7 @@
594 33aa809d 2019-08-08 stsp -----------------------------------------------
595 33aa809d 2019-08-08 stsp M numbers (change 2 of 3)
596 33aa809d 2019-08-08 stsp revert this change? [y/n/q] y
597 33aa809d 2019-08-08 stsp -----------------------------------------------
598 33aa809d 2019-08-08 stsp @@ -13,4 +13,4 @@
604 33aa809d 2019-08-08 stsp -----------------------------------------------
605 33aa809d 2019-08-08 stsp M numbers (change 3 of 3)
606 33aa809d 2019-08-08 stsp revert this change? [y/n/q] n
608 33aa809d 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
610 33aa809d 2019-08-08 stsp if [ "$ret" != "0" ]; then
611 33aa809d 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
612 33aa809d 2019-08-08 stsp test_done "$testroot" "$ret"
616 33aa809d 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
617 33aa809d 2019-08-08 stsp echo "M numbers" > $testroot/stdout.expected
618 33aa809d 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
620 33aa809d 2019-08-08 stsp if [ "$ret" != "0" ]; then
621 33aa809d 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
622 33aa809d 2019-08-08 stsp test_done "$testroot" "$ret"
626 33aa809d 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/stdout)
628 33aa809d 2019-08-08 stsp echo "diff $commit_id $testroot/wt" > $testroot/stdout.expected
629 33aa809d 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
630 33aa809d 2019-08-08 stsp got tree -r $testroot/repo -i -c $commit_id \
631 33aa809d 2019-08-08 stsp | grep 'numbers$' | cut -d' ' -f 1 \
632 33aa809d 2019-08-08 stsp >> $testroot/stdout.expected
633 33aa809d 2019-08-08 stsp echo 'file + numbers' >> $testroot/stdout.expected
634 33aa809d 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
635 33aa809d 2019-08-08 stsp --- numbers
636 33aa809d 2019-08-08 stsp +++ numbers
637 33aa809d 2019-08-08 stsp @@ -1,5 +1,5 @@
644 33aa809d 2019-08-08 stsp @@ -13,4 +13,4 @@
651 33aa809d 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
653 33aa809d 2019-08-08 stsp if [ "$ret" != "0" ]; then
654 33aa809d 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
655 33aa809d 2019-08-08 stsp test_done "$testroot" "$ret"
659 33aa809d 2019-08-08 stsp # revert last hunk
660 33aa809d 2019-08-08 stsp printf "n\ny\n" > $testroot/patchscript
661 33aa809d 2019-08-08 stsp (cd $testroot/wt && got revert -F $testroot/patchscript -p \
662 33aa809d 2019-08-08 stsp numbers > $testroot/stdout)
663 33aa809d 2019-08-08 stsp cat > $testroot/stdout.expected <<EOF
664 33aa809d 2019-08-08 stsp -----------------------------------------------
665 33aa809d 2019-08-08 stsp @@ -1,5 +1,5 @@
672 33aa809d 2019-08-08 stsp -----------------------------------------------
673 33aa809d 2019-08-08 stsp M numbers (change 1 of 2)
674 33aa809d 2019-08-08 stsp revert this change? [y/n/q] n
675 33aa809d 2019-08-08 stsp -----------------------------------------------
676 33aa809d 2019-08-08 stsp @@ -13,4 +13,4 @@
682 33aa809d 2019-08-08 stsp -----------------------------------------------
683 33aa809d 2019-08-08 stsp M numbers (change 2 of 2)
684 33aa809d 2019-08-08 stsp revert this change? [y/n/q] y
686 33aa809d 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
688 33aa809d 2019-08-08 stsp if [ "$ret" != "0" ]; then
689 33aa809d 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
690 33aa809d 2019-08-08 stsp test_done "$testroot" "$ret"
694 33aa809d 2019-08-08 stsp (cd $testroot/wt && got diff > $testroot/stdout)
696 33aa809d 2019-08-08 stsp echo "diff $commit_id $testroot/wt" > $testroot/stdout.expected
697 33aa809d 2019-08-08 stsp echo -n 'blob - ' >> $testroot/stdout.expected
698 33aa809d 2019-08-08 stsp got tree -r $testroot/repo -i -c $commit_id \
699 33aa809d 2019-08-08 stsp | grep 'numbers$' | cut -d' ' -f 1 \
700 33aa809d 2019-08-08 stsp >> $testroot/stdout.expected
701 33aa809d 2019-08-08 stsp echo 'file + numbers' >> $testroot/stdout.expected
702 33aa809d 2019-08-08 stsp cat >> $testroot/stdout.expected <<EOF
703 33aa809d 2019-08-08 stsp --- numbers
704 33aa809d 2019-08-08 stsp +++ numbers
705 33aa809d 2019-08-08 stsp @@ -1,5 +1,5 @@
713 33aa809d 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
715 33aa809d 2019-08-08 stsp if [ "$ret" != "0" ]; then
716 33aa809d 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
718 1f1abb7e 2019-08-08 stsp test_done "$testroot" "$ret"
721 f6cae3ed 2020-09-13 naddy test_revert_patch_added() {
722 33aa809d 2019-08-08 stsp local testroot=`test_init revert_patch_added`
723 33aa809d 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
725 33aa809d 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
727 33aa809d 2019-08-08 stsp if [ "$ret" != "0" ]; then
728 33aa809d 2019-08-08 stsp test_done "$testroot" "$ret"
732 33aa809d 2019-08-08 stsp echo "new" > $testroot/wt/epsilon/new
733 33aa809d 2019-08-08 stsp (cd $testroot/wt && got add epsilon/new > /dev/null)
735 33aa809d 2019-08-08 stsp printf "n\n" > $testroot/patchscript
736 33aa809d 2019-08-08 stsp (cd $testroot/wt && got revert -F $testroot/patchscript -p \
737 33aa809d 2019-08-08 stsp epsilon/new > $testroot/stdout)
739 33aa809d 2019-08-08 stsp echo "A epsilon/new" > $testroot/stdout.expected
740 33aa809d 2019-08-08 stsp echo "revert this addition? [y/n] n" >> $testroot/stdout.expected
741 33aa809d 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
743 33aa809d 2019-08-08 stsp if [ "$ret" != "0" ]; then
744 33aa809d 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
745 33aa809d 2019-08-08 stsp test_done "$testroot" "$ret"
749 33aa809d 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
750 33aa809d 2019-08-08 stsp echo "A epsilon/new" > $testroot/stdout.expected
751 33aa809d 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
753 33aa809d 2019-08-08 stsp if [ "$ret" != "0" ]; then
754 33aa809d 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
755 33aa809d 2019-08-08 stsp test_done "$testroot" "$ret"
759 33aa809d 2019-08-08 stsp printf "y\n" > $testroot/patchscript
760 33aa809d 2019-08-08 stsp (cd $testroot/wt && got revert -F $testroot/patchscript -p \
761 33aa809d 2019-08-08 stsp epsilon/new > $testroot/stdout)
763 33aa809d 2019-08-08 stsp echo "A epsilon/new" > $testroot/stdout.expected
764 33aa809d 2019-08-08 stsp echo "revert this addition? [y/n] y" >> $testroot/stdout.expected
765 33aa809d 2019-08-08 stsp echo "R epsilon/new" >> $testroot/stdout.expected
766 33aa809d 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
768 33aa809d 2019-08-08 stsp if [ "$ret" != "0" ]; then
769 33aa809d 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
770 33aa809d 2019-08-08 stsp test_done "$testroot" "$ret"
774 33aa809d 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
775 33aa809d 2019-08-08 stsp echo "? epsilon/new" > $testroot/stdout.expected
776 33aa809d 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
778 33aa809d 2019-08-08 stsp if [ "$ret" != "0" ]; then
779 33aa809d 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
781 33aa809d 2019-08-08 stsp test_done "$testroot" "$ret"
784 f6cae3ed 2020-09-13 naddy test_revert_patch_removed() {
785 33aa809d 2019-08-08 stsp local testroot=`test_init revert_patch_removed`
786 33aa809d 2019-08-08 stsp local commit_id=`git_show_head $testroot/repo`
788 33aa809d 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
790 33aa809d 2019-08-08 stsp if [ "$ret" != "0" ]; then
791 33aa809d 2019-08-08 stsp test_done "$testroot" "$ret"
795 33aa809d 2019-08-08 stsp (cd $testroot/wt && got rm beta > /dev/null)
797 33aa809d 2019-08-08 stsp printf "n\n" > $testroot/patchscript
798 33aa809d 2019-08-08 stsp (cd $testroot/wt && got revert -F $testroot/patchscript -p \
799 33aa809d 2019-08-08 stsp beta > $testroot/stdout)
800 33aa809d 2019-08-08 stsp echo "D beta" > $testroot/stdout.expected
801 33aa809d 2019-08-08 stsp echo "revert this deletion? [y/n] n" >> $testroot/stdout.expected
802 33aa809d 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
804 33aa809d 2019-08-08 stsp if [ "$ret" != "0" ]; then
805 33aa809d 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
806 33aa809d 2019-08-08 stsp test_done "$testroot" "$ret"
810 33aa809d 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
811 33aa809d 2019-08-08 stsp echo "D beta" > $testroot/stdout.expected
812 33aa809d 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
814 33aa809d 2019-08-08 stsp if [ "$ret" != "0" ]; then
815 33aa809d 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
816 33aa809d 2019-08-08 stsp test_done "$testroot" "$ret"
820 33aa809d 2019-08-08 stsp printf "y\n" > $testroot/patchscript
821 33aa809d 2019-08-08 stsp (cd $testroot/wt && got revert -F $testroot/patchscript -p \
822 33aa809d 2019-08-08 stsp beta > $testroot/stdout)
824 33aa809d 2019-08-08 stsp echo "D beta" > $testroot/stdout.expected
825 33aa809d 2019-08-08 stsp echo "revert this deletion? [y/n] y" >> $testroot/stdout.expected
826 33aa809d 2019-08-08 stsp echo "R beta" >> $testroot/stdout.expected
827 33aa809d 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
829 33aa809d 2019-08-08 stsp if [ "$ret" != "0" ]; then
830 33aa809d 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
831 33aa809d 2019-08-08 stsp test_done "$testroot" "$ret"
835 33aa809d 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
836 33aa809d 2019-08-08 stsp echo -n > $testroot/stdout.expected
837 33aa809d 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
839 33aa809d 2019-08-08 stsp if [ "$ret" != "0" ]; then
840 33aa809d 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
842 33aa809d 2019-08-08 stsp test_done "$testroot" "$ret"
845 f6cae3ed 2020-09-13 naddy test_revert_patch_one_change() {
846 f1e81a05 2019-08-10 stsp local testroot=`test_init revert_patch_one_change`
848 f1e81a05 2019-08-10 stsp jot 16 > $testroot/repo/numbers
849 f1e81a05 2019-08-10 stsp (cd $testroot/repo && git add numbers)
850 f1e81a05 2019-08-10 stsp git_commit $testroot/repo -m "added numbers file"
851 f1e81a05 2019-08-10 stsp local commit_id=`git_show_head $testroot/repo`
853 f1e81a05 2019-08-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
855 f1e81a05 2019-08-10 stsp if [ "$ret" != "0" ]; then
856 f1e81a05 2019-08-10 stsp test_done "$testroot" "$ret"
860 6c6b73bb 2019-08-10 stsp # Ensure file size is changed. Avoids race condition causing test
861 6c6b73bb 2019-08-10 stsp # failures where 'got revert' does not see changes to revert if
862 6c6b73bb 2019-08-10 stsp # timestamps and size in stat info remain unchanged.
863 6c6b73bb 2019-08-10 stsp sed -i -e 's/^2$/aa/' $testroot/wt/numbers
865 f1e81a05 2019-08-10 stsp # revert change with -p
866 f1e81a05 2019-08-10 stsp printf "y\n" > $testroot/patchscript
867 f1e81a05 2019-08-10 stsp (cd $testroot/wt && got revert -F $testroot/patchscript -p \
868 f1e81a05 2019-08-10 stsp numbers > $testroot/stdout)
870 f1e81a05 2019-08-10 stsp if [ "$ret" != "0" ]; then
871 f1e81a05 2019-08-10 stsp echo "got revert command failed unexpectedly" >&2
872 f1e81a05 2019-08-10 stsp test_done "$testroot" "1"
875 f1e81a05 2019-08-10 stsp cat > $testroot/stdout.expected <<EOF
876 f1e81a05 2019-08-10 stsp -----------------------------------------------
877 f1e81a05 2019-08-10 stsp @@ -1,5 +1,5 @@
884 f1e81a05 2019-08-10 stsp -----------------------------------------------
885 f1e81a05 2019-08-10 stsp M numbers (change 1 of 1)
886 f1e81a05 2019-08-10 stsp revert this change? [y/n/q] y
889 6c6b73bb 2019-08-10 stsp if [ "$ret" != "0" ]; then
890 6c6b73bb 2019-08-10 stsp echo "got revert command failed unexpectedly" >&2
891 6c6b73bb 2019-08-10 stsp test_done "$testroot" "1"
895 f1e81a05 2019-08-10 stsp cmp -s $testroot/stdout.expected $testroot/stdout
897 f1e81a05 2019-08-10 stsp if [ "$ret" != "0" ]; then
898 f1e81a05 2019-08-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
899 f1e81a05 2019-08-10 stsp test_done "$testroot" "$ret"
903 f1e81a05 2019-08-10 stsp (cd $testroot/wt && got status > $testroot/stdout)
904 f1e81a05 2019-08-10 stsp echo -n > $testroot/stdout.expected
905 f1e81a05 2019-08-10 stsp cmp -s $testroot/stdout.expected $testroot/stdout
907 f1e81a05 2019-08-10 stsp if [ "$ret" != "0" ]; then
908 f1e81a05 2019-08-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
909 f1e81a05 2019-08-10 stsp test_done "$testroot" "$ret"
913 f1e81a05 2019-08-10 stsp (cd $testroot/wt && got diff > $testroot/stdout)
914 f1e81a05 2019-08-10 stsp echo -n > $testroot/stdout.expected
915 f1e81a05 2019-08-10 stsp cmp -s $testroot/stdout.expected $testroot/stdout
917 f1e81a05 2019-08-10 stsp if [ "$ret" != "0" ]; then
918 f1e81a05 2019-08-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
920 f1e81a05 2019-08-10 stsp test_done "$testroot" "$ret"
923 f6cae3ed 2020-09-13 naddy test_revert_added_subtree() {
924 a46b9f33 2020-01-28 stsp local testroot=`test_init revert_added_subtree`
926 a46b9f33 2020-01-28 stsp got checkout $testroot/repo $testroot/wt > /dev/null
928 a46b9f33 2020-01-28 stsp if [ "$ret" != "0" ]; then
929 a46b9f33 2020-01-28 stsp test_done "$testroot" "$ret"
933 a46b9f33 2020-01-28 stsp mkdir -p $testroot/wt/epsilon/foo/bar/baz
934 a46b9f33 2020-01-28 stsp mkdir -p $testroot/wt/epsilon/foo/bar/bax
935 a46b9f33 2020-01-28 stsp echo "new file" > $testroot/wt/epsilon/foo/a.o
936 a46b9f33 2020-01-28 stsp echo "new file" > $testroot/wt/epsilon/foo/a.o
937 a46b9f33 2020-01-28 stsp echo "new file" > $testroot/wt/epsilon/foo/bar/b.o
938 a46b9f33 2020-01-28 stsp echo "new file" > $testroot/wt/epsilon/foo/bar/b.d
939 a46b9f33 2020-01-28 stsp echo "new file" > $testroot/wt/epsilon/foo/bar/baz/f.o
940 a46b9f33 2020-01-28 stsp echo "new file" > $testroot/wt/epsilon/foo/bar/baz/f.d
941 a46b9f33 2020-01-28 stsp echo "new file" > $testroot/wt/epsilon/foo/bar/baz/c.o
942 a46b9f33 2020-01-28 stsp echo "new file" > $testroot/wt/epsilon/foo/bar/baz/c.d
943 a46b9f33 2020-01-28 stsp echo "new file" > $testroot/wt/epsilon/foo/bar/bax/e.o
944 a46b9f33 2020-01-28 stsp echo "new file" > $testroot/wt/epsilon/foo/bar/bax/e.d
945 a46b9f33 2020-01-28 stsp echo "new file" > $testroot/wt/epsilon/foo/bar/bax/x.o
946 a46b9f33 2020-01-28 stsp echo "new file" > $testroot/wt/epsilon/foo/bar/bax/x.d
947 a46b9f33 2020-01-28 stsp (cd $testroot/wt && got add -R epsilon >/dev/null)
949 a46b9f33 2020-01-28 stsp echo "R epsilon/foo/a.o" > $testroot/stdout.expected
950 a46b9f33 2020-01-28 stsp echo "R epsilon/foo/bar/b.d" >> $testroot/stdout.expected
951 a46b9f33 2020-01-28 stsp echo "R epsilon/foo/bar/b.o" >> $testroot/stdout.expected
952 a46b9f33 2020-01-28 stsp echo "R epsilon/foo/bar/bax/e.d" >> $testroot/stdout.expected
953 a46b9f33 2020-01-28 stsp echo "R epsilon/foo/bar/bax/e.o" >> $testroot/stdout.expected
954 a46b9f33 2020-01-28 stsp echo "R epsilon/foo/bar/bax/x.d" >> $testroot/stdout.expected
955 a46b9f33 2020-01-28 stsp echo "R epsilon/foo/bar/bax/x.o" >> $testroot/stdout.expected
956 a46b9f33 2020-01-28 stsp echo "R epsilon/foo/bar/baz/c.d" >> $testroot/stdout.expected
957 a46b9f33 2020-01-28 stsp echo "R epsilon/foo/bar/baz/c.o" >> $testroot/stdout.expected
958 a46b9f33 2020-01-28 stsp echo "R epsilon/foo/bar/baz/f.d" >> $testroot/stdout.expected
959 a46b9f33 2020-01-28 stsp echo "R epsilon/foo/bar/baz/f.o" >> $testroot/stdout.expected
961 a46b9f33 2020-01-28 stsp (cd $testroot/wt && got revert -R . > $testroot/stdout)
963 a46b9f33 2020-01-28 stsp cmp -s $testroot/stdout.expected $testroot/stdout
965 a46b9f33 2020-01-28 stsp if [ "$ret" != "0" ]; then
966 a46b9f33 2020-01-28 stsp diff -u $testroot/stdout.expected $testroot/stdout
967 a46b9f33 2020-01-28 stsp test_done "$testroot" "$ret"
971 a46b9f33 2020-01-28 stsp echo "? epsilon/foo/a.o" > $testroot/stdout.expected
972 a46b9f33 2020-01-28 stsp echo "? epsilon/foo/bar/b.d" >> $testroot/stdout.expected
973 a46b9f33 2020-01-28 stsp echo "? epsilon/foo/bar/b.o" >> $testroot/stdout.expected
974 a46b9f33 2020-01-28 stsp echo "? epsilon/foo/bar/bax/e.d" >> $testroot/stdout.expected
975 a46b9f33 2020-01-28 stsp echo "? epsilon/foo/bar/bax/e.o" >> $testroot/stdout.expected
976 a46b9f33 2020-01-28 stsp echo "? epsilon/foo/bar/bax/x.d" >> $testroot/stdout.expected
977 a46b9f33 2020-01-28 stsp echo "? epsilon/foo/bar/bax/x.o" >> $testroot/stdout.expected
978 a46b9f33 2020-01-28 stsp echo "? epsilon/foo/bar/baz/c.d" >> $testroot/stdout.expected
979 a46b9f33 2020-01-28 stsp echo "? epsilon/foo/bar/baz/c.o" >> $testroot/stdout.expected
980 a46b9f33 2020-01-28 stsp echo "? epsilon/foo/bar/baz/f.d" >> $testroot/stdout.expected
981 a46b9f33 2020-01-28 stsp echo "? epsilon/foo/bar/baz/f.o" >> $testroot/stdout.expected
983 15341bfd 2020-03-05 tracey (cd $testroot/wt && got status > $testroot/stdout)
985 15341bfd 2020-03-05 tracey cmp -s $testroot/stdout.expected $testroot/stdout
987 15341bfd 2020-03-05 tracey if [ "$ret" != "0" ]; then
988 15341bfd 2020-03-05 tracey diff -u $testroot/stdout.expected $testroot/stdout
990 15341bfd 2020-03-05 tracey test_done "$testroot" "$ret"
993 f6cae3ed 2020-09-13 naddy test_revert_deleted_subtree() {
994 15341bfd 2020-03-05 tracey local testroot=`test_init revert_deleted_subtree`
996 15341bfd 2020-03-05 tracey got checkout $testroot/repo $testroot/wt > /dev/null
998 15341bfd 2020-03-05 tracey if [ "$ret" != "0" ]; then
999 15341bfd 2020-03-05 tracey test_done "$testroot" "$ret"
1000 15341bfd 2020-03-05 tracey return 1
1003 15341bfd 2020-03-05 tracey mkdir -p $testroot/wt/epsilon/foo/bar/baz
1004 15341bfd 2020-03-05 tracey mkdir -p $testroot/wt/epsilon/foo/bar/bax
1005 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/a.o
1006 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/a.o
1007 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/bar/b.o
1008 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/bar/b.d
1009 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/bar/baz/f.o
1010 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/bar/baz/f.d
1011 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/bar/baz/c.o
1012 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/bar/baz/c.d
1013 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/bar/bax/e.o
1014 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/bar/bax/e.d
1015 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/bar/bax/x.o
1016 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/bar/bax/x.d
1017 15341bfd 2020-03-05 tracey (cd $testroot/wt && got add -R epsilon >/dev/null)
1018 15341bfd 2020-03-05 tracey (cd $testroot/wt && got commit -m "add subtree" >/dev/null)
1020 15341bfd 2020-03-05 tracey # now delete and revert the entire subtree
1021 15341bfd 2020-03-05 tracey (cd $testroot/wt && got rm -R epsilon/foo >/dev/null)
1023 15341bfd 2020-03-05 tracey echo "R epsilon/foo/a.o" > $testroot/stdout.expected
1024 15341bfd 2020-03-05 tracey echo "R epsilon/foo/bar/b.d" >> $testroot/stdout.expected
1025 15341bfd 2020-03-05 tracey echo "R epsilon/foo/bar/b.o" >> $testroot/stdout.expected
1026 15341bfd 2020-03-05 tracey echo "R epsilon/foo/bar/bax/e.d" >> $testroot/stdout.expected
1027 15341bfd 2020-03-05 tracey echo "R epsilon/foo/bar/bax/e.o" >> $testroot/stdout.expected
1028 15341bfd 2020-03-05 tracey echo "R epsilon/foo/bar/bax/x.d" >> $testroot/stdout.expected
1029 15341bfd 2020-03-05 tracey echo "R epsilon/foo/bar/bax/x.o" >> $testroot/stdout.expected
1030 15341bfd 2020-03-05 tracey echo "R epsilon/foo/bar/baz/c.d" >> $testroot/stdout.expected
1031 15341bfd 2020-03-05 tracey echo "R epsilon/foo/bar/baz/c.o" >> $testroot/stdout.expected
1032 15341bfd 2020-03-05 tracey echo "R epsilon/foo/bar/baz/f.d" >> $testroot/stdout.expected
1033 15341bfd 2020-03-05 tracey echo "R epsilon/foo/bar/baz/f.o" >> $testroot/stdout.expected
1035 15341bfd 2020-03-05 tracey (cd $testroot/wt && got revert -R . > $testroot/stdout)
1037 15341bfd 2020-03-05 tracey cmp -s $testroot/stdout.expected $testroot/stdout
1038 15341bfd 2020-03-05 tracey ret="$?"
1039 15341bfd 2020-03-05 tracey if [ "$ret" != "0" ]; then
1040 15341bfd 2020-03-05 tracey diff -u $testroot/stdout.expected $testroot/stdout
1041 15341bfd 2020-03-05 tracey test_done "$testroot" "$ret"
1042 15341bfd 2020-03-05 tracey return 1
1045 15341bfd 2020-03-05 tracey echo -n > $testroot/stdout.expected
1046 a46b9f33 2020-01-28 stsp (cd $testroot/wt && got status > $testroot/stdout)
1048 a46b9f33 2020-01-28 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1050 a46b9f33 2020-01-28 stsp if [ "$ret" != "0" ]; then
1051 a46b9f33 2020-01-28 stsp diff -u $testroot/stdout.expected $testroot/stdout
1053 a46b9f33 2020-01-28 stsp test_done "$testroot" "$ret"
1056 f6cae3ed 2020-09-13 naddy test_revert_symlink() {
1057 4901ccfc 2020-07-23 stsp local testroot=`test_init revert_symlink`
1059 4901ccfc 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
1060 4901ccfc 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
1061 4901ccfc 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
1062 4901ccfc 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
1063 4901ccfc 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
1064 4901ccfc 2020-07-23 stsp (cd $testroot/repo && ln -sf epsilon/zeta zeta.link)
1065 4901ccfc 2020-07-23 stsp (cd $testroot/repo && git add .)
1066 4901ccfc 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
1067 4901ccfc 2020-07-23 stsp local commit_id1=`git_show_head $testroot/repo`
1069 4901ccfc 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1071 4901ccfc 2020-07-23 stsp # symlink to file A now points to file B
1072 4901ccfc 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta alpha.link)
1073 4901ccfc 2020-07-23 stsp # symlink to a directory A now points to file B
1074 4901ccfc 2020-07-23 stsp (cd $testroot/wt && ln -sfh beta epsilon.link)
1075 4901ccfc 2020-07-23 stsp # "bad" symlink now contains a different target path
1076 4901ccfc 2020-07-23 stsp echo "foo" > $testroot/wt/passwd.link
1077 4901ccfc 2020-07-23 stsp # relative symlink to directory A now points to relative directory B
1078 4901ccfc 2020-07-23 stsp (cd $testroot/wt && ln -sfh ../gamma epsilon/beta.link)
1079 4901ccfc 2020-07-23 stsp # an unversioned symlink
1080 4901ccfc 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/foo dotgotfoo.link)
1081 4901ccfc 2020-07-23 stsp # symlink to file A now points to non-existent file B
1082 4901ccfc 2020-07-23 stsp (cd $testroot/wt && ln -sf nonexistent2 nonexistent.link)
1083 4901ccfc 2020-07-23 stsp # removed symlink
1084 4901ccfc 2020-07-23 stsp (cd $testroot/wt && got rm zeta.link > /dev/null)
1085 4901ccfc 2020-07-23 stsp # added symlink
1086 4901ccfc 2020-07-23 stsp (cd $testroot/wt && ln -sf beta new.link)
1087 4901ccfc 2020-07-23 stsp (cd $testroot/wt && got add new.link > /dev/null)
1089 4901ccfc 2020-07-23 stsp (cd $testroot/wt && got revert alpha.link epsilon.link \
1090 4901ccfc 2020-07-23 stsp passwd.link epsilon/beta.link dotgotfoo.link \
1091 4901ccfc 2020-07-23 stsp nonexistent.link zeta.link new.link > $testroot/stdout)
1093 4901ccfc 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
1094 4901ccfc 2020-07-23 stsp R alpha.link
1095 4901ccfc 2020-07-23 stsp R epsilon.link
1096 4901ccfc 2020-07-23 stsp R passwd.link
1097 4901ccfc 2020-07-23 stsp R epsilon/beta.link
1098 4901ccfc 2020-07-23 stsp R nonexistent.link
1099 4901ccfc 2020-07-23 stsp R zeta.link
1100 4901ccfc 2020-07-23 stsp R new.link
1102 4901ccfc 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1104 4901ccfc 2020-07-23 stsp if [ "$ret" != "0" ]; then
1105 4901ccfc 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1106 4901ccfc 2020-07-23 stsp test_done "$testroot" "$ret"
1110 4901ccfc 2020-07-23 stsp if ! [ -h $testroot/wt/alpha.link ]; then
1111 4901ccfc 2020-07-23 stsp echo "alpha.link is not a symlink"
1112 4901ccfc 2020-07-23 stsp test_done "$testroot" "1"
1116 4901ccfc 2020-07-23 stsp readlink $testroot/wt/alpha.link > $testroot/stdout
1117 4901ccfc 2020-07-23 stsp echo "alpha" > $testroot/stdout.expected
1118 4901ccfc 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1120 4901ccfc 2020-07-23 stsp if [ "$ret" != "0" ]; then
1121 4901ccfc 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1122 4901ccfc 2020-07-23 stsp test_done "$testroot" "$ret"
1126 4901ccfc 2020-07-23 stsp if ! [ -h $testroot/wt/epsilon.link ]; then
1127 4901ccfc 2020-07-23 stsp echo "epsilon.link is not a symlink"
1128 4901ccfc 2020-07-23 stsp test_done "$testroot" "1"
1132 4901ccfc 2020-07-23 stsp readlink $testroot/wt/epsilon.link > $testroot/stdout
1133 4901ccfc 2020-07-23 stsp echo "epsilon" > $testroot/stdout.expected
1134 4901ccfc 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1136 4901ccfc 2020-07-23 stsp if [ "$ret" != "0" ]; then
1137 4901ccfc 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1138 4901ccfc 2020-07-23 stsp test_done "$testroot" "$ret"
1142 4901ccfc 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
1143 4901ccfc 2020-07-23 stsp echo "passwd.link should not be a symlink" >&2
1144 4901ccfc 2020-07-23 stsp test_done "$testroot" "1"
1148 4901ccfc 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
1149 4901ccfc 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
1151 4901ccfc 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
1153 4901ccfc 2020-07-23 stsp if [ "$ret" != "0" ]; then
1154 4901ccfc 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
1155 4901ccfc 2020-07-23 stsp test_done "$testroot" "$ret"
1159 4901ccfc 2020-07-23 stsp readlink $testroot/wt/epsilon/beta.link > $testroot/stdout
1160 4901ccfc 2020-07-23 stsp echo "../beta" > $testroot/stdout.expected
1161 4901ccfc 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1163 4901ccfc 2020-07-23 stsp if [ "$ret" != "0" ]; then
1164 4901ccfc 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1165 4901ccfc 2020-07-23 stsp test_done "$testroot" "$ret"
1169 4901ccfc 2020-07-23 stsp readlink $testroot/wt/nonexistent.link > $testroot/stdout
1170 4901ccfc 2020-07-23 stsp echo "nonexistent" > $testroot/stdout.expected
1171 4901ccfc 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1173 4901ccfc 2020-07-23 stsp if [ "$ret" != "0" ]; then
1174 4901ccfc 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1175 4901ccfc 2020-07-23 stsp test_done "$testroot" "$ret"
1179 4901ccfc 2020-07-23 stsp if [ ! -h $testroot/wt/dotgotfoo.link ]; then
1180 4901ccfc 2020-07-23 stsp echo "dotgotfoo.link is not a symlink " >&2
1181 4901ccfc 2020-07-23 stsp test_done "$testroot" "1"
1184 4901ccfc 2020-07-23 stsp readlink $testroot/wt/dotgotfoo.link > $testroot/stdout
1185 4901ccfc 2020-07-23 stsp echo ".got/foo" > $testroot/stdout.expected
1186 4901ccfc 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1188 4901ccfc 2020-07-23 stsp if [ "$ret" != "0" ]; then
1189 4901ccfc 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1190 4901ccfc 2020-07-23 stsp test_done "$testroot" "$ret"
1194 4901ccfc 2020-07-23 stsp if [ ! -h $testroot/wt/zeta.link ]; then
1195 4901ccfc 2020-07-23 stsp echo -n "zeta.link is not a symlink" >&2
1196 4901ccfc 2020-07-23 stsp test_done "$testroot" "1"
1200 4901ccfc 2020-07-23 stsp readlink $testroot/wt/zeta.link > $testroot/stdout
1201 4901ccfc 2020-07-23 stsp echo "epsilon/zeta" > $testroot/stdout.expected
1202 4901ccfc 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1204 4901ccfc 2020-07-23 stsp if [ "$ret" != "0" ]; then
1205 4901ccfc 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1206 4901ccfc 2020-07-23 stsp test_done "$testroot" "$ret"
1210 4901ccfc 2020-07-23 stsp if [ ! -h $testroot/wt/new.link ]; then
1211 4901ccfc 2020-07-23 stsp echo -n "new.link is not a symlink" >&2
1212 4901ccfc 2020-07-23 stsp test_done "$testroot" "1"
1216 4901ccfc 2020-07-23 stsp (cd $testroot/wt && got status > $testroot/stdout)
1217 4901ccfc 2020-07-23 stsp echo "? dotgotfoo.link" > $testroot/stdout.expected
1218 4901ccfc 2020-07-23 stsp echo "? new.link" >> $testroot/stdout.expected
1219 4901ccfc 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1221 4901ccfc 2020-07-23 stsp if [ "$ret" != "0" ]; then
1222 4901ccfc 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1225 4901ccfc 2020-07-23 stsp test_done "$testroot" "$ret"
1228 f6cae3ed 2020-09-13 naddy test_revert_patch_symlink() {
1229 369fd7e5 2020-07-23 stsp local testroot=`test_init revert_patch_symlink`
1231 369fd7e5 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
1232 369fd7e5 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
1233 369fd7e5 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
1234 369fd7e5 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
1235 369fd7e5 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
1236 369fd7e5 2020-07-23 stsp (cd $testroot/repo && ln -sf epsilon/zeta zeta.link)
1237 369fd7e5 2020-07-23 stsp (cd $testroot/repo && ln -sf epsilon/zeta zeta2.link)
1238 369fd7e5 2020-07-23 stsp (cd $testroot/repo && git add .)
1239 369fd7e5 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
1240 369fd7e5 2020-07-23 stsp local commit_id1=`git_show_head $testroot/repo`
1242 369fd7e5 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1244 369fd7e5 2020-07-23 stsp # symlink to file A now points to file B
1245 369fd7e5 2020-07-23 stsp (cd $testroot/wt && ln -sf gamma/delta alpha.link)
1246 369fd7e5 2020-07-23 stsp # symlink to a directory A now points to file B
1247 369fd7e5 2020-07-23 stsp (cd $testroot/wt && ln -sfh beta epsilon.link)
1248 369fd7e5 2020-07-23 stsp # "bad" symlink now contains a different target path
1249 369fd7e5 2020-07-23 stsp echo "foo" > $testroot/wt/passwd.link
1250 369fd7e5 2020-07-23 stsp # relative symlink to directory A now points to relative directory B
1251 369fd7e5 2020-07-23 stsp (cd $testroot/wt && ln -sfh ../gamma epsilon/beta.link)
1252 369fd7e5 2020-07-23 stsp # an unversioned symlink
1253 369fd7e5 2020-07-23 stsp (cd $testroot/wt && ln -sf .got/foo dotgotfoo.link)
1254 369fd7e5 2020-07-23 stsp # symlink to file A now points to non-existent file B
1255 369fd7e5 2020-07-23 stsp (cd $testroot/wt && ln -sf nonexistent2 nonexistent.link)
1256 369fd7e5 2020-07-23 stsp # removed symlink
1257 369fd7e5 2020-07-23 stsp (cd $testroot/wt && got rm zeta.link > /dev/null)
1258 369fd7e5 2020-07-23 stsp (cd $testroot/wt && got rm zeta2.link > /dev/null)
1259 369fd7e5 2020-07-23 stsp # added symlink
1260 369fd7e5 2020-07-23 stsp (cd $testroot/wt && ln -sf beta new.link)
1261 369fd7e5 2020-07-23 stsp (cd $testroot/wt && got add new.link > /dev/null)
1262 369fd7e5 2020-07-23 stsp (cd $testroot/wt && ln -sf beta zeta3.link)
1263 369fd7e5 2020-07-23 stsp (cd $testroot/wt && got add zeta3.link > /dev/null)
1265 369fd7e5 2020-07-23 stsp printf "y\nn\ny\nn\ny\ny\nn\ny\ny\n" > $testroot/patchscript
1266 369fd7e5 2020-07-23 stsp (cd $testroot/wt && got revert -F $testroot/patchscript -p -R . \
1267 369fd7e5 2020-07-23 stsp > $testroot/stdout)
1269 369fd7e5 2020-07-23 stsp if [ "$ret" != "0" ]; then
1270 369fd7e5 2020-07-23 stsp echo "got revert command failed unexpectedly" >&2
1271 369fd7e5 2020-07-23 stsp test_done "$testroot" "1"
1274 369fd7e5 2020-07-23 stsp cat > $testroot/stdout.expected <<EOF
1275 369fd7e5 2020-07-23 stsp -----------------------------------------------
1276 369fd7e5 2020-07-23 stsp @@ -1 +1 @@
1278 369fd7e5 2020-07-23 stsp \ No newline at end of file
1279 369fd7e5 2020-07-23 stsp +gamma/delta
1280 369fd7e5 2020-07-23 stsp \ No newline at end of file
1281 369fd7e5 2020-07-23 stsp -----------------------------------------------
1282 369fd7e5 2020-07-23 stsp M alpha.link (change 1 of 1)
1283 369fd7e5 2020-07-23 stsp revert this change? [y/n/q] y
1284 369fd7e5 2020-07-23 stsp R alpha.link
1285 369fd7e5 2020-07-23 stsp -----------------------------------------------
1286 369fd7e5 2020-07-23 stsp @@ -1 +1 @@
1288 369fd7e5 2020-07-23 stsp \ No newline at end of file
1290 369fd7e5 2020-07-23 stsp \ No newline at end of file
1291 369fd7e5 2020-07-23 stsp -----------------------------------------------
1292 369fd7e5 2020-07-23 stsp M epsilon/beta.link (change 1 of 1)
1293 369fd7e5 2020-07-23 stsp revert this change? [y/n/q] n
1294 369fd7e5 2020-07-23 stsp -----------------------------------------------
1295 369fd7e5 2020-07-23 stsp @@ -1 +1 @@
1297 369fd7e5 2020-07-23 stsp \ No newline at end of file
1299 369fd7e5 2020-07-23 stsp \ No newline at end of file
1300 369fd7e5 2020-07-23 stsp -----------------------------------------------
1301 369fd7e5 2020-07-23 stsp M epsilon.link (change 1 of 1)
1302 369fd7e5 2020-07-23 stsp revert this change? [y/n/q] y
1303 369fd7e5 2020-07-23 stsp R epsilon.link
1304 369fd7e5 2020-07-23 stsp A new.link
1305 369fd7e5 2020-07-23 stsp revert this addition? [y/n] n
1306 369fd7e5 2020-07-23 stsp -----------------------------------------------
1307 369fd7e5 2020-07-23 stsp @@ -1 +1 @@
1308 369fd7e5 2020-07-23 stsp -nonexistent
1309 369fd7e5 2020-07-23 stsp \ No newline at end of file
1310 369fd7e5 2020-07-23 stsp +nonexistent2
1311 369fd7e5 2020-07-23 stsp \ No newline at end of file
1312 369fd7e5 2020-07-23 stsp -----------------------------------------------
1313 369fd7e5 2020-07-23 stsp M nonexistent.link (change 1 of 1)
1314 369fd7e5 2020-07-23 stsp revert this change? [y/n/q] y
1315 369fd7e5 2020-07-23 stsp R nonexistent.link
1316 369fd7e5 2020-07-23 stsp -----------------------------------------------
1317 369fd7e5 2020-07-23 stsp @@ -1 +1 @@
1318 369fd7e5 2020-07-23 stsp -/etc/passwd
1319 369fd7e5 2020-07-23 stsp \ No newline at end of file
1321 369fd7e5 2020-07-23 stsp -----------------------------------------------
1322 369fd7e5 2020-07-23 stsp M passwd.link (change 1 of 1)
1323 369fd7e5 2020-07-23 stsp revert this change? [y/n/q] y
1324 369fd7e5 2020-07-23 stsp R passwd.link
1325 369fd7e5 2020-07-23 stsp D zeta.link
1326 369fd7e5 2020-07-23 stsp revert this deletion? [y/n] n
1327 369fd7e5 2020-07-23 stsp D zeta2.link
1328 369fd7e5 2020-07-23 stsp revert this deletion? [y/n] y
1329 369fd7e5 2020-07-23 stsp R zeta2.link
1330 369fd7e5 2020-07-23 stsp A zeta3.link
1331 369fd7e5 2020-07-23 stsp revert this addition? [y/n] y
1332 369fd7e5 2020-07-23 stsp R zeta3.link
1334 369fd7e5 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1336 369fd7e5 2020-07-23 stsp if [ "$ret" != "0" ]; then
1337 369fd7e5 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1338 369fd7e5 2020-07-23 stsp test_done "$testroot" "$ret"
1342 369fd7e5 2020-07-23 stsp if ! [ -h $testroot/wt/alpha.link ]; then
1343 369fd7e5 2020-07-23 stsp echo "alpha.link is not a symlink"
1344 369fd7e5 2020-07-23 stsp test_done "$testroot" "1"
1348 369fd7e5 2020-07-23 stsp readlink $testroot/wt/alpha.link > $testroot/stdout
1349 369fd7e5 2020-07-23 stsp echo "alpha" > $testroot/stdout.expected
1350 369fd7e5 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1352 369fd7e5 2020-07-23 stsp if [ "$ret" != "0" ]; then
1353 369fd7e5 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1354 369fd7e5 2020-07-23 stsp test_done "$testroot" "$ret"
1358 369fd7e5 2020-07-23 stsp if ! [ -h $testroot/wt/epsilon.link ]; then
1359 369fd7e5 2020-07-23 stsp echo "epsilon.link is not a symlink"
1360 369fd7e5 2020-07-23 stsp test_done "$testroot" "1"
1364 369fd7e5 2020-07-23 stsp readlink $testroot/wt/epsilon.link > $testroot/stdout
1365 369fd7e5 2020-07-23 stsp echo "epsilon" > $testroot/stdout.expected
1366 369fd7e5 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1368 369fd7e5 2020-07-23 stsp if [ "$ret" != "0" ]; then
1369 369fd7e5 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1370 369fd7e5 2020-07-23 stsp test_done "$testroot" "$ret"
1374 369fd7e5 2020-07-23 stsp if [ -h $testroot/wt/passwd.link ]; then
1375 369fd7e5 2020-07-23 stsp echo "passwd.link should not be a symlink" >&2
1376 369fd7e5 2020-07-23 stsp test_done "$testroot" "1"
1380 369fd7e5 2020-07-23 stsp echo -n "/etc/passwd" > $testroot/content.expected
1381 369fd7e5 2020-07-23 stsp cp $testroot/wt/passwd.link $testroot/content
1383 369fd7e5 2020-07-23 stsp cmp -s $testroot/content.expected $testroot/content
1385 369fd7e5 2020-07-23 stsp if [ "$ret" != "0" ]; then
1386 369fd7e5 2020-07-23 stsp diff -u $testroot/content.expected $testroot/content
1387 369fd7e5 2020-07-23 stsp test_done "$testroot" "$ret"
1391 369fd7e5 2020-07-23 stsp readlink $testroot/wt/epsilon/beta.link > $testroot/stdout
1392 369fd7e5 2020-07-23 stsp echo "../gamma" > $testroot/stdout.expected
1393 369fd7e5 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1395 369fd7e5 2020-07-23 stsp if [ "$ret" != "0" ]; then
1396 369fd7e5 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1397 369fd7e5 2020-07-23 stsp test_done "$testroot" "$ret"
1401 369fd7e5 2020-07-23 stsp readlink $testroot/wt/nonexistent.link > $testroot/stdout
1402 369fd7e5 2020-07-23 stsp echo "nonexistent" > $testroot/stdout.expected
1403 369fd7e5 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1405 369fd7e5 2020-07-23 stsp if [ "$ret" != "0" ]; then
1406 369fd7e5 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1407 369fd7e5 2020-07-23 stsp test_done "$testroot" "$ret"
1411 369fd7e5 2020-07-23 stsp if [ ! -h $testroot/wt/dotgotfoo.link ]; then
1412 369fd7e5 2020-07-23 stsp echo "dotgotfoo.link is not a symlink " >&2
1413 369fd7e5 2020-07-23 stsp test_done "$testroot" "1"
1416 369fd7e5 2020-07-23 stsp readlink $testroot/wt/dotgotfoo.link > $testroot/stdout
1417 369fd7e5 2020-07-23 stsp echo ".got/foo" > $testroot/stdout.expected
1418 369fd7e5 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1420 369fd7e5 2020-07-23 stsp if [ "$ret" != "0" ]; then
1421 369fd7e5 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1422 369fd7e5 2020-07-23 stsp test_done "$testroot" "$ret"
1427 369fd7e5 2020-07-23 stsp if [ -e $testroot/wt/zeta.link ]; then
1428 369fd7e5 2020-07-23 stsp echo -n "zeta.link should not exist on disk" >&2
1429 369fd7e5 2020-07-23 stsp test_done "$testroot" "1"
1433 369fd7e5 2020-07-23 stsp if [ ! -h $testroot/wt/zeta2.link ]; then
1434 369fd7e5 2020-07-23 stsp echo -n "zeta2.link is not a symlink" >&2
1435 369fd7e5 2020-07-23 stsp test_done "$testroot" "1"
1439 369fd7e5 2020-07-23 stsp readlink $testroot/wt/zeta2.link > $testroot/stdout
1440 369fd7e5 2020-07-23 stsp echo "epsilon/zeta" > $testroot/stdout.expected
1441 369fd7e5 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1443 369fd7e5 2020-07-23 stsp if [ "$ret" != "0" ]; then
1444 369fd7e5 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1445 369fd7e5 2020-07-23 stsp test_done "$testroot" "$ret"
1449 369fd7e5 2020-07-23 stsp if [ ! -h $testroot/wt/zeta3.link ]; then
1450 369fd7e5 2020-07-23 stsp echo -n "zeta3.link is not a symlink" >&2
1451 369fd7e5 2020-07-23 stsp test_done "$testroot" "1"
1455 cf0e59fe 2020-07-23 stsp readlink $testroot/wt/zeta3.link > $testroot/stdout
1456 cf0e59fe 2020-07-23 stsp echo "beta" > $testroot/stdout.expected
1457 369fd7e5 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1459 369fd7e5 2020-07-23 stsp if [ "$ret" != "0" ]; then
1460 369fd7e5 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1461 369fd7e5 2020-07-23 stsp test_done "$testroot" "$ret"
1465 369fd7e5 2020-07-23 stsp if [ ! -h $testroot/wt/new.link ]; then
1466 369fd7e5 2020-07-23 stsp echo -n "new.link is not a symlink" >&2
1467 369fd7e5 2020-07-23 stsp test_done "$testroot" "1"
1471 369fd7e5 2020-07-23 stsp (cd $testroot/wt && got status > $testroot/stdout)
1472 369fd7e5 2020-07-23 stsp echo "? dotgotfoo.link" > $testroot/stdout.expected
1473 369fd7e5 2020-07-23 stsp echo "M epsilon/beta.link" >> $testroot/stdout.expected
1474 369fd7e5 2020-07-23 stsp echo "A new.link" >> $testroot/stdout.expected
1475 369fd7e5 2020-07-23 stsp echo "D zeta.link" >> $testroot/stdout.expected
1476 369fd7e5 2020-07-23 stsp echo "? zeta3.link" >> $testroot/stdout.expected
1477 369fd7e5 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1479 369fd7e5 2020-07-23 stsp if [ "$ret" != "0" ]; then
1480 369fd7e5 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1483 369fd7e5 2020-07-23 stsp test_done "$testroot" "$ret"
1486 7fb414ae 2020-08-08 stsp test_parseargs "$@"
1487 a129376b 2019-03-28 stsp run_test test_revert_basic
1488 a129376b 2019-03-28 stsp run_test test_revert_rm
1489 a129376b 2019-03-28 stsp run_test test_revert_add
1490 e20a8b6f 2019-06-04 stsp run_test test_revert_multiple
1491 a9fa2909 2019-07-27 stsp run_test test_revert_file_in_new_subdir
1492 1f1abb7e 2019-08-08 stsp run_test test_revert_no_arguments
1493 0f6d7415 2019-08-08 stsp run_test test_revert_directory
1494 3d69ad8d 2019-08-17 semarie run_test test_revert_directory_unknown
1495 33aa809d 2019-08-08 stsp run_test test_revert_patch
1496 33aa809d 2019-08-08 stsp run_test test_revert_patch_added
1497 33aa809d 2019-08-08 stsp run_test test_revert_patch_removed
1498 f1e81a05 2019-08-10 stsp run_test test_revert_patch_one_change
1499 a46b9f33 2020-01-28 stsp run_test test_revert_added_subtree
1500 15341bfd 2020-03-05 tracey run_test test_revert_deleted_subtree
1501 4901ccfc 2020-07-23 stsp run_test test_revert_symlink
1502 369fd7e5 2020-07-23 stsp run_test test_revert_patch_symlink