Merge branch 'ph/mergetool'
[git/git-p4.git] / t / t9600-cvsimport.sh
blob655f88270b27b637b6d4b7d3fdb3af76f525064f
1 #!/bin/sh
3 test_description='git-cvsimport basic tests'
4 . ./test-lib.sh
6 CVSROOT=$(pwd)/cvsroot
7 export CVSROOT
8 # for clean cvsps cache
9 HOME=$(pwd)
10 export HOME
12 if ! type cvs >/dev/null 2>&1
13 then
14 say 'skipping cvsimport tests, cvs not found'
15 test_done
16 exit
19 cvsps_version=`cvsps -h 2>&1 | sed -ne 's/cvsps version //p'`
20 case "$cvsps_version" in
21 2.1)
23 '')
24 say 'skipping cvsimport tests, cvsps not found'
25 test_done
26 exit
29 say 'skipping cvsimport tests, cvsps too old'
30 test_done
31 exit
33 esac
35 test_expect_success 'setup cvsroot' 'cvs init'
37 test_expect_success 'setup a cvs module' '
39 mkdir "$CVSROOT/module" &&
40 cvs co -d module-cvs module &&
41 cd module-cvs &&
42 cat <<EOF >o_fortuna &&
43 O Fortuna
44 velut luna
45 statu variabilis,
47 semper crescis
48 aut decrescis;
49 vita detestabilis
51 nunc obdurat
52 et tunc curat
53 ludo mentis aciem,
55 egestatem,
56 potestatem
57 dissolvit ut glaciem.
58 EOF
59 cvs add o_fortuna &&
60 cat <<EOF >message &&
61 add "O Fortuna" lyrics
63 These public domain lyrics make an excellent sample text.
64 EOF
65 cvs commit -F message &&
66 cd ..
69 test_expect_success 'import a trivial module' '
71 git cvsimport -a -z 0 -C module-git module &&
72 test_cmp module-cvs/o_fortuna module-git/o_fortuna
76 test_expect_success 'pack refs' 'cd module-git && git gc && cd ..'
78 test_expect_success 'update cvs module' '
80 cd module-cvs &&
81 cat <<EOF >o_fortuna &&
82 O Fortune,
83 like the moon
84 you are changeable,
86 ever waxing
87 and waning;
88 hateful life
90 first oppresses
91 and then soothes
92 as fancy takes it;
94 poverty
95 and power
96 it melts them like ice.
97 EOF
98 cat <<EOF >message &&
99 translate to English
101 My Latin is terrible.
103 cvs commit -F message &&
104 cd ..
107 test_expect_success 'update git module' '
109 cd module-git &&
110 git cvsimport -a -z 0 module &&
111 git merge origin &&
112 cd .. &&
113 test_cmp module-cvs/o_fortuna module-git/o_fortuna
117 test_expect_success 'update cvs module' '
119 cd module-cvs &&
120 echo 1 >tick &&
121 cvs add tick &&
122 cvs commit -m 1
123 cd ..
127 test_expect_success 'cvsimport.module config works' '
129 cd module-git &&
130 git config cvsimport.module module &&
131 git cvsimport -a -z0 &&
132 git merge origin &&
133 cd .. &&
134 test_cmp module-cvs/tick module-git/tick
138 test_expect_success 'import from a CVS working tree' '
140 cvs co -d import-from-wt module &&
141 cd import-from-wt &&
142 git cvsimport -a -z0 &&
143 echo 1 >expect &&
144 git log -1 --pretty=format:%s%n >actual &&
145 test_cmp actual expect &&
146 cd ..
150 test_done