3 # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
5 # Permission to use, copy, modify, and distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 function test_revert_basic {
20 local testroot=`test_init revert_basic`
22 got checkout $testroot/repo $testroot/wt > /dev/null
24 if [ "$ret" != "0" ]; then
25 test_done "$testroot" "$ret"
29 echo "modified epsilon/zeta" > $testroot/wt/epsilon/zeta
31 echo 'R epsilon/zeta' > $testroot/stdout.expected
33 (cd $testroot/wt && got revert epsilon/zeta > $testroot/stdout)
35 cmp -s $testroot/stdout.expected $testroot/stdout
37 if [ "$ret" != "0" ]; then
38 diff -u $testroot/stdout.expected $testroot/stdout
39 test_done "$testroot" "$ret"
43 echo "zeta" > $testroot/content.expected
44 cat $testroot/wt/epsilon/zeta > $testroot/content
46 cmp -s $testroot/content.expected $testroot/content
48 if [ "$ret" != "0" ]; then
49 diff -u $testroot/content.expected $testroot/content
51 test_done "$testroot" "$ret"
55 function test_revert_rm {
56 local testroot=`test_init revert_rm`
58 got checkout $testroot/repo $testroot/wt > /dev/null
60 if [ "$ret" != "0" ]; then
61 test_done "$testroot" "$ret"
65 (cd $testroot/wt && got rm beta >/dev/null)
67 echo 'R beta' > $testroot/stdout.expected
69 (cd $testroot/wt && got revert beta > $testroot/stdout)
71 cmp -s $testroot/stdout.expected $testroot/stdout
73 if [ "$ret" != "0" ]; then
74 diff -u $testroot/stdout.expected $testroot/stdout
75 test_done "$testroot" "$ret"
79 echo "beta" > $testroot/content.expected
80 cat $testroot/wt/beta > $testroot/content
82 cmp -s $testroot/content.expected $testroot/content
84 if [ "$ret" != "0" ]; then
85 diff -u $testroot/content.expected $testroot/content
87 test_done "$testroot" "$ret"
90 function test_revert_add {
91 local testroot=`test_init revert_add`
93 got checkout $testroot/repo $testroot/wt > /dev/null
95 if [ "$ret" != "0" ]; then
96 test_done "$testroot" "$ret"
100 echo "new file" > $testroot/wt/new
101 (cd $testroot/wt && got add new >/dev/null)
103 echo 'R new' > $testroot/stdout.expected
105 (cd $testroot/wt && got revert new > $testroot/stdout)
107 cmp -s $testroot/stdout.expected $testroot/stdout
109 if [ "$ret" != "0" ]; then
110 diff -u $testroot/stdout.expected $testroot/stdout
111 test_done "$testroot" "$ret"
115 echo "new file" > $testroot/content.expected
116 cat $testroot/wt/new > $testroot/content
118 cmp -s $testroot/content.expected $testroot/content
120 if [ "$ret" != "0" ]; then
121 diff -u $testroot/content.expected $testroot/content
122 test_done "$testroot" "$ret"
126 echo '? new' > $testroot/stdout.expected
128 (cd $testroot/wt && got status > $testroot/stdout)
130 cmp -s $testroot/stdout.expected $testroot/stdout
132 if [ "$ret" != "0" ]; then
133 diff -u $testroot/stdout.expected $testroot/stdout
135 test_done "$testroot" "$ret"
138 function test_revert_multiple {
139 local testroot=`test_init revert_multiple`
141 got checkout $testroot/repo $testroot/wt > /dev/null
143 if [ "$ret" != "0" ]; then
144 test_done "$testroot" "$ret"
148 echo "modified alpha" > $testroot/wt/alpha
149 echo "modified epsilon/zeta" > $testroot/wt/epsilon/zeta
151 echo 'R alpha' > $testroot/stdout.expected
152 echo 'R epsilon/zeta' >> $testroot/stdout.expected
154 (cd $testroot/wt && got revert alpha epsilon/zeta > $testroot/stdout)
156 cmp -s $testroot/stdout.expected $testroot/stdout
158 if [ "$ret" != "0" ]; then
159 diff -u $testroot/stdout.expected $testroot/stdout
160 test_done "$testroot" "$ret"
164 echo "alpha" > $testroot/content.expected
165 cat $testroot/wt/alpha > $testroot/content
167 cmp -s $testroot/content.expected $testroot/content
169 if [ "$ret" != "0" ]; then
170 diff -u $testroot/content.expected $testroot/content
171 test_done "$testroot" "$ret"
175 echo "zeta" > $testroot/content.expected
176 cat $testroot/wt/epsilon/zeta > $testroot/content
178 cmp -s $testroot/content.expected $testroot/content
180 if [ "$ret" != "0" ]; then
181 diff -u $testroot/content.expected $testroot/content
183 test_done "$testroot" "$ret"
186 function test_revert_file_in_new_subdir {
187 local testroot=`test_init revert_file_in_new_subdir`
189 got checkout $testroot/repo $testroot/wt > /dev/null
191 if [ "$ret" != "0" ]; then
192 test_done "$testroot" "$ret"
197 mkdir -p $testroot/wt/newdir
198 echo new > $testroot/wt/newdir/new
199 (cd $testroot/wt && got add newdir/new > /dev/null)
201 (cd $testroot/wt && got revert newdir/new > $testroot/stdout)
203 echo "R newdir/new" > $testroot/stdout.expected
204 cmp -s $testroot/stdout.expected $testroot/stdout
206 if [ "$ret" != "0" ]; then
207 diff -u $testroot/stdout.expected $testroot/stdout
208 test_done "$testroot" "$ret"
212 (cd $testroot/wt && got status > $testroot/stdout)
214 echo "? newdir/new" > $testroot/stdout.expected
215 cmp -s $testroot/stdout.expected $testroot/stdout
217 if [ "$ret" != "0" ]; then
218 diff -u $testroot/stdout.expected $testroot/stdout
220 test_done "$testroot" "$ret"
224 function test_revert_no_arguments {
225 local testroot=`test_init revert_no_arguments`
227 got checkout $testroot/repo $testroot/wt > /dev/null
229 if [ "$ret" != "0" ]; then
230 test_done "$testroot" "$ret"
234 echo "modified epsilon/zeta" > $testroot/wt/epsilon/zeta
236 (cd $testroot/wt && got revert > $testroot/stdout 2> $testroot/stderr)
238 if [ "$ret" == "0" ]; then
239 echo "revert command succeeded unexpectedly" >&2
240 test_done "$testroot" "1"
244 echo -n > $testroot/stdout.expected
245 cmp -s $testroot/stdout.expected $testroot/stdout
247 if [ "$ret" != "0" ]; then
248 diff -u $testroot/stdout.expected $testroot/stdout
249 test_done "$testroot" "$ret"
253 echo "usage: got revert [-p] [-F response-script] [-R] path ..." \
254 > $testroot/stderr.expected
255 cmp -s $testroot/stderr.expected $testroot/stderr
257 if [ "$ret" != "0" ]; then
258 diff -u $testroot/stderr.expected $testroot/stderr
260 test_done "$testroot" "$ret"
263 function test_revert_directory {
264 local testroot=`test_init revert_directory`
266 got checkout $testroot/repo $testroot/wt > /dev/null
268 if [ "$ret" != "0" ]; then
269 test_done "$testroot" "$ret"
273 echo "modified epsilon/zeta" > $testroot/wt/epsilon/zeta
275 (cd $testroot/wt && got revert . > $testroot/stdout 2> $testroot/stderr)
277 if [ "$ret" == "0" ]; then
278 echo "got revert command succeeded unexpectedly" >&2
279 test_done "$testroot" "1"
282 echo "got: reverting directories requires -R option" \
283 > $testroot/stderr.expected
284 cmp -s $testroot/stderr.expected $testroot/stderr
286 if [ "$ret" != "0" ]; then
287 diff -u $testroot/stderr.expected $testroot/stderr
288 test_done "$testroot" "$ret"
292 echo -n > $testroot/stdout.expected
293 cmp -s $testroot/stdout.expected $testroot/stdout
295 if [ "$ret" != "0" ]; then
296 diff -u $testroot/stdout.expected $testroot/stdout
297 test_done "$testroot" "$ret"
301 (cd $testroot/wt && got revert -R . > $testroot/stdout)
303 echo 'R epsilon/zeta' > $testroot/stdout.expected
304 cmp -s $testroot/stdout.expected $testroot/stdout
306 if [ "$ret" != "0" ]; then
307 diff -u $testroot/stdout.expected $testroot/stdout
308 test_done "$testroot" "$ret"
312 echo "zeta" > $testroot/content.expected
313 cat $testroot/wt/epsilon/zeta > $testroot/content
315 cmp -s $testroot/content.expected $testroot/content
317 if [ "$ret" != "0" ]; then
318 diff -u $testroot/content.expected $testroot/content
320 test_done "$testroot" "$ret"
323 function test_revert_directory_unknown {
324 local testroot=`test_init revert_directory_unknown`
326 got checkout $testroot/repo $testroot/wt > /dev/null
328 if [ "$ret" != "0" ]; then
329 test_done "$testroot" "$ret"
333 echo "modified alpha" > $testroot/wt/alpha
334 echo "new untracked file" > $testroot/wt/epsilon/new_file
335 echo "modified epsilon/zeta" > $testroot/wt/epsilon/zeta
337 (cd $testroot/wt && got revert -R . > $testroot/stdout)
339 echo 'R alpha' > $testroot/stdout.expected
340 echo '? epsilon/new_file' >> $testroot/stdout.expected
341 echo 'R epsilon/zeta' >> $testroot/stdout.expected
342 cmp -s $testroot/stdout.expected $testroot/stdout
344 if [ "$ret" != "0" ]; then
345 diff -u $testroot/stdout.expected $testroot/stdout
346 test_done "$testroot" "$ret"
350 echo "new untracked file" > $testroot/content.expected
351 cat $testroot/wt/epsilon/new_file > $testroot/content
353 cmp -s $testroot/content.expected $testroot/content
355 if [ "$ret" != "0" ]; then
356 diff -u $testroot/content.expected $testroot/content
357 test_done "$testroot" "$ret"
361 echo "zeta" > $testroot/content.expected
362 cat $testroot/wt/epsilon/zeta > $testroot/content
364 cmp -s $testroot/content.expected $testroot/content
366 if [ "$ret" != "0" ]; then
367 diff -u $testroot/content.expected $testroot/content
370 test_done "$testroot" "$ret"
373 function test_revert_patch {
374 local testroot=`test_init revert_patch`
376 jot 16 > $testroot/repo/numbers
377 (cd $testroot/repo && git add numbers)
378 git_commit $testroot/repo -m "added numbers file"
379 local commit_id=`git_show_head $testroot/repo`
381 got checkout $testroot/repo $testroot/wt > /dev/null
383 if [ "$ret" != "0" ]; then
384 test_done "$testroot" "$ret"
388 sed -i -e 's/^2$/a/' $testroot/wt/numbers
389 sed -i -e 's/^7$/b/' $testroot/wt/numbers
390 sed -i -e 's/^16$/c/' $testroot/wt/numbers
392 (cd $testroot/wt && got diff > $testroot/numbers.diff)
394 # don't revert any hunks
395 printf "n\nn\nn\n" > $testroot/patchscript
396 (cd $testroot/wt && got revert -F $testroot/patchscript -p \
397 numbers > $testroot/stdout)
399 if [ "$ret" != "0" ]; then
400 echo "got revert command failed unexpectedly" >&2
401 test_done "$testroot" "1"
404 cat > $testroot/stdout.expected <<EOF
405 -----------------------------------------------
413 -----------------------------------------------
414 M numbers (change 1 of 3)
415 revert this change? [y/n/q] n
416 -----------------------------------------------
426 -----------------------------------------------
427 M numbers (change 2 of 3)
428 revert this change? [y/n/q] n
429 -----------------------------------------------
436 -----------------------------------------------
437 M numbers (change 3 of 3)
438 revert this change? [y/n/q] n
440 cmp -s $testroot/stdout.expected $testroot/stdout
442 if [ "$ret" != "0" ]; then
443 diff -u $testroot/stdout.expected $testroot/stdout
444 test_done "$testroot" "$ret"
448 (cd $testroot/wt && got status > $testroot/stdout)
449 echo "M numbers" > $testroot/stdout.expected
450 cmp -s $testroot/stdout.expected $testroot/stdout
452 if [ "$ret" != "0" ]; then
453 diff -u $testroot/stdout.expected $testroot/stdout
454 test_done "$testroot" "$ret"
458 (cd $testroot/wt && got diff > $testroot/stdout)
459 cmp -s $testroot/numbers.diff $testroot/stdout
461 if [ "$ret" != "0" ]; then
462 diff -u $testroot/numbers.diff $testroot/stdout
463 test_done "$testroot" "$ret"
468 printf "y\nn\nn\n" > $testroot/patchscript
469 (cd $testroot/wt && got revert -F $testroot/patchscript -p \
470 numbers > $testroot/stdout)
472 if [ "$ret" != "0" ]; then
473 echo "got revert command failed unexpectedly" >&2
474 test_done "$testroot" "1"
477 cat > $testroot/stdout.expected <<EOF
478 -----------------------------------------------
486 -----------------------------------------------
487 M numbers (change 1 of 3)
488 revert this change? [y/n/q] y
489 -----------------------------------------------
499 -----------------------------------------------
500 M numbers (change 2 of 3)
501 revert this change? [y/n/q] n
502 -----------------------------------------------
509 -----------------------------------------------
510 M numbers (change 3 of 3)
511 revert this change? [y/n/q] n
513 cmp -s $testroot/stdout.expected $testroot/stdout
515 if [ "$ret" != "0" ]; then
516 diff -u $testroot/stdout.expected $testroot/stdout
517 test_done "$testroot" "$ret"
521 (cd $testroot/wt && got status > $testroot/stdout)
522 echo "M numbers" > $testroot/stdout.expected
523 cmp -s $testroot/stdout.expected $testroot/stdout
525 if [ "$ret" != "0" ]; then
526 diff -u $testroot/stdout.expected $testroot/stdout
527 test_done "$testroot" "$ret"
531 echo "diff $commit_id $testroot/wt" > $testroot/stdout.expected
532 echo -n 'blob - ' >> $testroot/stdout.expected
533 got tree -r $testroot/repo -i -c $commit_id \
534 | grep 'numbers$' | cut -d' ' -f 1 \
535 >> $testroot/stdout.expected
536 echo 'file + numbers' >> $testroot/stdout.expected
537 cat >> $testroot/stdout.expected <<EOF
556 (cd $testroot/wt && got diff > $testroot/stdout)
557 cmp -s $testroot/stdout.expected $testroot/stdout
559 if [ "$ret" != "0" ]; then
560 diff -u $testroot/stdout.expected $testroot/stdout
561 test_done "$testroot" "$ret"
565 # put first hunk back
566 sed -i -e 's/^2$/a/' $testroot/wt/numbers
569 printf "n\ny\nn\n" > $testroot/patchscript
570 (cd $testroot/wt && got revert -F $testroot/patchscript -p \
571 numbers > $testroot/stdout)
573 cat > $testroot/stdout.expected <<EOF
574 -----------------------------------------------
582 -----------------------------------------------
583 M numbers (change 1 of 3)
584 revert this change? [y/n/q] n
585 -----------------------------------------------
595 -----------------------------------------------
596 M numbers (change 2 of 3)
597 revert this change? [y/n/q] y
598 -----------------------------------------------
605 -----------------------------------------------
606 M numbers (change 3 of 3)
607 revert this change? [y/n/q] n
609 cmp -s $testroot/stdout.expected $testroot/stdout
611 if [ "$ret" != "0" ]; then
612 diff -u $testroot/stdout.expected $testroot/stdout
613 test_done "$testroot" "$ret"
617 (cd $testroot/wt && got status > $testroot/stdout)
618 echo "M numbers" > $testroot/stdout.expected
619 cmp -s $testroot/stdout.expected $testroot/stdout
621 if [ "$ret" != "0" ]; then
622 diff -u $testroot/stdout.expected $testroot/stdout
623 test_done "$testroot" "$ret"
627 (cd $testroot/wt && got diff > $testroot/stdout)
629 echo "diff $commit_id $testroot/wt" > $testroot/stdout.expected
630 echo -n 'blob - ' >> $testroot/stdout.expected
631 got tree -r $testroot/repo -i -c $commit_id \
632 | grep 'numbers$' | cut -d' ' -f 1 \
633 >> $testroot/stdout.expected
634 echo 'file + numbers' >> $testroot/stdout.expected
635 cat >> $testroot/stdout.expected <<EOF
652 cmp -s $testroot/stdout.expected $testroot/stdout
654 if [ "$ret" != "0" ]; then
655 diff -u $testroot/stdout.expected $testroot/stdout
656 test_done "$testroot" "$ret"
661 printf "n\ny\n" > $testroot/patchscript
662 (cd $testroot/wt && got revert -F $testroot/patchscript -p \
663 numbers > $testroot/stdout)
664 cat > $testroot/stdout.expected <<EOF
665 -----------------------------------------------
673 -----------------------------------------------
674 M numbers (change 1 of 2)
675 revert this change? [y/n/q] n
676 -----------------------------------------------
683 -----------------------------------------------
684 M numbers (change 2 of 2)
685 revert this change? [y/n/q] y
687 cmp -s $testroot/stdout.expected $testroot/stdout
689 if [ "$ret" != "0" ]; then
690 diff -u $testroot/stdout.expected $testroot/stdout
691 test_done "$testroot" "$ret"
695 (cd $testroot/wt && got diff > $testroot/stdout)
697 echo "diff $commit_id $testroot/wt" > $testroot/stdout.expected
698 echo -n 'blob - ' >> $testroot/stdout.expected
699 got tree -r $testroot/repo -i -c $commit_id \
700 | grep 'numbers$' | cut -d' ' -f 1 \
701 >> $testroot/stdout.expected
702 echo 'file + numbers' >> $testroot/stdout.expected
703 cat >> $testroot/stdout.expected <<EOF
714 cmp -s $testroot/stdout.expected $testroot/stdout
716 if [ "$ret" != "0" ]; then
717 diff -u $testroot/stdout.expected $testroot/stdout
719 test_done "$testroot" "$ret"
722 function test_revert_patch_added {
723 local testroot=`test_init revert_patch_added`
724 local commit_id=`git_show_head $testroot/repo`
726 got checkout $testroot/repo $testroot/wt > /dev/null
728 if [ "$ret" != "0" ]; then
729 test_done "$testroot" "$ret"
733 echo "new" > $testroot/wt/epsilon/new
734 (cd $testroot/wt && got add epsilon/new > /dev/null)
736 printf "n\n" > $testroot/patchscript
737 (cd $testroot/wt && got revert -F $testroot/patchscript -p \
738 epsilon/new > $testroot/stdout)
740 echo "A epsilon/new" > $testroot/stdout.expected
741 echo "revert this addition? [y/n] n" >> $testroot/stdout.expected
742 cmp -s $testroot/stdout.expected $testroot/stdout
744 if [ "$ret" != "0" ]; then
745 diff -u $testroot/stdout.expected $testroot/stdout
746 test_done "$testroot" "$ret"
750 (cd $testroot/wt && got status > $testroot/stdout)
751 echo "A epsilon/new" > $testroot/stdout.expected
752 cmp -s $testroot/stdout.expected $testroot/stdout
754 if [ "$ret" != "0" ]; then
755 diff -u $testroot/stdout.expected $testroot/stdout
756 test_done "$testroot" "$ret"
760 printf "y\n" > $testroot/patchscript
761 (cd $testroot/wt && got revert -F $testroot/patchscript -p \
762 epsilon/new > $testroot/stdout)
764 echo "A epsilon/new" > $testroot/stdout.expected
765 echo "revert this addition? [y/n] y" >> $testroot/stdout.expected
766 echo "R epsilon/new" >> $testroot/stdout.expected
767 cmp -s $testroot/stdout.expected $testroot/stdout
769 if [ "$ret" != "0" ]; then
770 diff -u $testroot/stdout.expected $testroot/stdout
771 test_done "$testroot" "$ret"
775 (cd $testroot/wt && got status > $testroot/stdout)
776 echo "? epsilon/new" > $testroot/stdout.expected
777 cmp -s $testroot/stdout.expected $testroot/stdout
779 if [ "$ret" != "0" ]; then
780 diff -u $testroot/stdout.expected $testroot/stdout
782 test_done "$testroot" "$ret"
785 function test_revert_patch_removed {
786 local testroot=`test_init revert_patch_removed`
787 local commit_id=`git_show_head $testroot/repo`
789 got checkout $testroot/repo $testroot/wt > /dev/null
791 if [ "$ret" != "0" ]; then
792 test_done "$testroot" "$ret"
796 (cd $testroot/wt && got rm beta > /dev/null)
798 printf "n\n" > $testroot/patchscript
799 (cd $testroot/wt && got revert -F $testroot/patchscript -p \
800 beta > $testroot/stdout)
801 echo "D beta" > $testroot/stdout.expected
802 echo "revert this deletion? [y/n] n" >> $testroot/stdout.expected
803 cmp -s $testroot/stdout.expected $testroot/stdout
805 if [ "$ret" != "0" ]; then
806 diff -u $testroot/stdout.expected $testroot/stdout
807 test_done "$testroot" "$ret"
811 (cd $testroot/wt && got status > $testroot/stdout)
812 echo "D beta" > $testroot/stdout.expected
813 cmp -s $testroot/stdout.expected $testroot/stdout
815 if [ "$ret" != "0" ]; then
816 diff -u $testroot/stdout.expected $testroot/stdout
817 test_done "$testroot" "$ret"
821 printf "y\n" > $testroot/patchscript
822 (cd $testroot/wt && got revert -F $testroot/patchscript -p \
823 beta > $testroot/stdout)
825 echo "D beta" > $testroot/stdout.expected
826 echo "revert this deletion? [y/n] y" >> $testroot/stdout.expected
827 echo "R beta" >> $testroot/stdout.expected
828 cmp -s $testroot/stdout.expected $testroot/stdout
830 if [ "$ret" != "0" ]; then
831 diff -u $testroot/stdout.expected $testroot/stdout
832 test_done "$testroot" "$ret"
836 (cd $testroot/wt && got status > $testroot/stdout)
837 echo -n > $testroot/stdout.expected
838 cmp -s $testroot/stdout.expected $testroot/stdout
840 if [ "$ret" != "0" ]; then
841 diff -u $testroot/stdout.expected $testroot/stdout
843 test_done "$testroot" "$ret"
846 function test_revert_patch_one_change {
847 local testroot=`test_init revert_patch_one_change`
849 jot 16 > $testroot/repo/numbers
850 (cd $testroot/repo && git add numbers)
851 git_commit $testroot/repo -m "added numbers file"
852 local commit_id=`git_show_head $testroot/repo`
854 got checkout $testroot/repo $testroot/wt > /dev/null
856 if [ "$ret" != "0" ]; then
857 test_done "$testroot" "$ret"
861 # Ensure file size is changed. Avoids race condition causing test
862 # failures where 'got revert' does not see changes to revert if
863 # timestamps and size in stat info remain unchanged.
864 sed -i -e 's/^2$/aa/' $testroot/wt/numbers
866 # revert change with -p
867 printf "y\n" > $testroot/patchscript
868 (cd $testroot/wt && got revert -F $testroot/patchscript -p \
869 numbers > $testroot/stdout)
871 if [ "$ret" != "0" ]; then
872 echo "got revert command failed unexpectedly" >&2
873 test_done "$testroot" "1"
876 cat > $testroot/stdout.expected <<EOF
877 -----------------------------------------------
885 -----------------------------------------------
886 M numbers (change 1 of 1)
887 revert this change? [y/n/q] y
890 if [ "$ret" != "0" ]; then
891 echo "got revert command failed unexpectedly" >&2
892 test_done "$testroot" "1"
896 cmp -s $testroot/stdout.expected $testroot/stdout
898 if [ "$ret" != "0" ]; then
899 diff -u $testroot/stdout.expected $testroot/stdout
900 test_done "$testroot" "$ret"
904 (cd $testroot/wt && got status > $testroot/stdout)
905 echo -n > $testroot/stdout.expected
906 cmp -s $testroot/stdout.expected $testroot/stdout
908 if [ "$ret" != "0" ]; then
909 diff -u $testroot/stdout.expected $testroot/stdout
910 test_done "$testroot" "$ret"
914 (cd $testroot/wt && got diff > $testroot/stdout)
915 echo -n > $testroot/stdout.expected
916 cmp -s $testroot/stdout.expected $testroot/stdout
918 if [ "$ret" != "0" ]; then
919 diff -u $testroot/stdout.expected $testroot/stdout
921 test_done "$testroot" "$ret"
924 run_test test_revert_basic
925 run_test test_revert_rm
926 run_test test_revert_add
927 run_test test_revert_multiple
928 run_test test_revert_file_in_new_subdir
929 run_test test_revert_no_arguments
930 run_test test_revert_directory
931 run_test test_revert_directory_unknown
932 run_test test_revert_patch
933 run_test test_revert_patch_added
934 run_test test_revert_patch_removed
935 run_test test_revert_patch_one_change