]>
Commit | Line | Data |
---|---|---|
795c7c0b JK |
1 | #!/bin/sh |
2 | ||
f964732c | 3 | test_description='git cvsimport basic tests' |
795c7c0b JK |
4 | . ./test-lib.sh |
5 | ||
1b19ccd2 JK |
6 | if ! test_have_prereq PERL; then |
7 | say 'skipping git cvsimport tests, perl not available' | |
8 | test_done | |
9 | fi | |
10 | ||
40ae8872 FL |
11 | CVSROOT=$(pwd)/cvsroot |
12 | export CVSROOT | |
374488f3 | 13 | unset CVS_SERVER |
40ae8872 FL |
14 | # for clean cvsps cache |
15 | HOME=$(pwd) | |
16 | export HOME | |
17 | ||
dcbcb707 | 18 | if ! type cvs >/dev/null 2>&1 |
795c7c0b | 19 | then |
dcbcb707 | 20 | say 'skipping cvsimport tests, cvs not found' |
795c7c0b | 21 | test_done |
795c7c0b JK |
22 | fi |
23 | ||
dcbcb707 JK |
24 | cvsps_version=`cvsps -h 2>&1 | sed -ne 's/cvsps version //p'` |
25 | case "$cvsps_version" in | |
a271b2a9 | 26 | 2.1 | 2.2*) |
dcbcb707 JK |
27 | ;; |
28 | '') | |
29 | say 'skipping cvsimport tests, cvsps not found' | |
30 | test_done | |
dcbcb707 JK |
31 | ;; |
32 | *) | |
a271b2a9 | 33 | say 'skipping cvsimport tests, unsupported cvsps version' |
dcbcb707 | 34 | test_done |
dcbcb707 JK |
35 | ;; |
36 | esac | |
37 | ||
795c7c0b JK |
38 | test_expect_success 'setup cvsroot' 'cvs init' |
39 | ||
40 | test_expect_success 'setup a cvs module' ' | |
41 | ||
f69e836f | 42 | mkdir "$CVSROOT/module" && |
795c7c0b JK |
43 | cvs co -d module-cvs module && |
44 | cd module-cvs && | |
45 | cat <<EOF >o_fortuna && | |
46 | O Fortuna | |
47 | velut luna | |
48 | statu variabilis, | |
49 | ||
50 | semper crescis | |
51 | aut decrescis; | |
52 | vita detestabilis | |
53 | ||
54 | nunc obdurat | |
55 | et tunc curat | |
56 | ludo mentis aciem, | |
57 | ||
58 | egestatem, | |
59 | potestatem | |
60 | dissolvit ut glaciem. | |
61 | EOF | |
62 | cvs add o_fortuna && | |
63 | cat <<EOF >message && | |
64 | add "O Fortuna" lyrics | |
65 | ||
66 | These public domain lyrics make an excellent sample text. | |
67 | EOF | |
68 | cvs commit -F message && | |
69 | cd .. | |
70 | ' | |
71 | ||
72 | test_expect_success 'import a trivial module' ' | |
73 | ||
74 | git cvsimport -a -z 0 -C module-git module && | |
3af82863 | 75 | test_cmp module-cvs/o_fortuna module-git/o_fortuna |
795c7c0b JK |
76 | |
77 | ' | |
78 | ||
9da0dabc JK |
79 | test_expect_success 'pack refs' 'cd module-git && git gc && cd ..' |
80 | ||
795c7c0b JK |
81 | test_expect_success 'update cvs module' ' |
82 | ||
83 | cd module-cvs && | |
84 | cat <<EOF >o_fortuna && | |
85 | O Fortune, | |
86 | like the moon | |
87 | you are changeable, | |
88 | ||
89 | ever waxing | |
90 | and waning; | |
91 | hateful life | |
92 | ||
93 | first oppresses | |
94 | and then soothes | |
95 | as fancy takes it; | |
96 | ||
97 | poverty | |
98 | and power | |
99 | it melts them like ice. | |
100 | EOF | |
101 | cat <<EOF >message && | |
102 | translate to English | |
103 | ||
104 | My Latin is terrible. | |
105 | EOF | |
106 | cvs commit -F message && | |
107 | cd .. | |
108 | ' | |
109 | ||
110 | test_expect_success 'update git module' ' | |
111 | ||
112 | cd module-git && | |
113 | git cvsimport -a -z 0 module && | |
114 | git merge origin && | |
115 | cd .. && | |
3af82863 | 116 | test_cmp module-cvs/o_fortuna module-git/o_fortuna |
795c7c0b JK |
117 | |
118 | ' | |
119 | ||
67d23242 JK |
120 | test_expect_success 'update cvs module' ' |
121 | ||
122 | cd module-cvs && | |
123 | echo 1 >tick && | |
124 | cvs add tick && | |
125 | cvs commit -m 1 | |
126 | cd .. | |
127 | ||
128 | ' | |
129 | ||
130 | test_expect_success 'cvsimport.module config works' ' | |
131 | ||
132 | cd module-git && | |
133 | git config cvsimport.module module && | |
134 | git cvsimport -a -z0 && | |
135 | git merge origin && | |
136 | cd .. && | |
3af82863 | 137 | test_cmp module-cvs/tick module-git/tick |
67d23242 JK |
138 | |
139 | ' | |
140 | ||
4e596e98 JK |
141 | test_expect_success 'import from a CVS working tree' ' |
142 | ||
143 | cvs co -d import-from-wt module && | |
144 | cd import-from-wt && | |
145 | git cvsimport -a -z0 && | |
146 | echo 1 >expect && | |
147 | git log -1 --pretty=format:%s%n >actual && | |
3af82863 | 148 | test_cmp actual expect && |
4e596e98 JK |
149 | cd .. |
150 | ||
151 | ' | |
152 | ||
795c7c0b | 153 | test_done |