]>
Tony Duckles's Git Repositories (git.nynim.org) - svn2svn.git/blob - tests/make-ref-repo.sh
2 # Create a reference repo with both /trunk and /branches history
5 LOG
=$(svn log -l1 $REPOURL)
6 revision
=$(echo "$LOG" | head -n 2 | tail -n 1| cut -d \| -f 1)
7 comment
=$(echo "$LOG" | head -n 4 | tail -n 1)
10 len
=$(expr ${#REPOURL} + 7)
11 url
=$(svn info $WC | grep "URL:" | cut -c$len-)
14 printf "%-6s%-22s%s\n" "$revision" "$url" "$comment"
26 REPOURL
="file://$REPO"
31 echo "Creating _repo_ref..."
33 svn
mkdir -q -m "Add /trunk" $REPOURL/trunk
35 svn
mkdir -q -m "Add /branches" $REPOURL/branches
37 TRUNK
="$REPOURL/trunk"
42 mkdir -p $WC/Module
/ProjectA
43 echo "Module/ProjectA/FileA1.txt (Initial)" >> $WC/Module
/ProjectA
/FileA1.txt
44 echo "Module/ProjectA/FileA2.txt (Initial)" >> $WC/Module
/ProjectA
/FileA2.txt
46 svn_commit
"Initial population"
48 # Test #1: Add new file
49 # * Test simple copy-from branch
50 BRANCH
="$REPOURL/branches/test1"
51 svn copy
-q -m "Create branch" $TRUNK $BRANCH
54 mkdir -p $WC/Module
/ProjectB
55 echo "Module/ProjectB/FileB1.txt (Test 1)" >> $WC/Module
/ProjectB
/FileB1.txt
56 svn add
-q $WC/Module
/ProjectB
57 svn_commit
"Test 1: Add Module/ProjectB"
60 svn ci
-q --with-revprop 'testprop=Test 1 message' -m "Test 1: Add Module/ProjectB"
64 # Test #2: Rename files
65 # * Test rename support
66 # * Test committing rename in two different branch commits: first deletion, then add
67 BRANCH
="$REPOURL/branches/test2"
68 svn copy
-q -m "Create branch" $TRUNK $BRANCH
71 svn
mv -q Module
/ProjectA
/FileA2.txt Module
/ProjectB
/FileB2.txt
72 echo "Module/ProjectB/FileB2.txt (Test 2)" >> $WC/Module
/ProjectB
/FileB2.txt
73 svn_commit
"Test 2: Rename Module/ProjectA/FileA2.txt -> Module/ProjectB/FileB2.txt (part 1 of 2)" Module
/ProjectA
74 svn_commit
"Test 2: Rename Module/ProjectA/FileA2.txt -> Module/ProjectB/FileB2.txt (part 2 of 2)" Module
/ProjectB
77 svn_commit
"Test 2: Rename Module/ProjectA/FileA2.txt -> Module/ProjectB/FileB3.txt"
79 # Test #3: Verify rename
80 BRANCH
="$REPOURL/branches/test3"
81 svn copy
-q -m "Create branch" $TRUNK $BRANCH
84 echo "Module/ProjectB/FileB2.txt (Test 3)" >> $WC/Module
/ProjectB
/FileB2.txt
85 svn_commit
"Test 3: Verify Module/ProjectB/FileB2.txt"
88 svn_commit
"Test 3: Verify Module/ProjectB/FileB2.txt"
90 # Test #4: Replace files
91 # * Test replace support
92 BRANCH
="$REPOURL/branches/test4"
93 svn copy
-q -m "Create branch" $TRUNK $BRANCH
96 svn
rm -q Module
/ProjectA
/FileA1.txt
97 echo "Module/ProjectA/FileA1.txt (Test 4 - Replaced)" >> $WC/Module
/ProjectA
/FileA1.txt
98 svn add
-q Module
/ProjectA
/FileA1.txt
99 svn_commit
"Test 4: Replace Module/ProjectA/FileA1.txt"
102 svn_commit
"Test 4: Replace Module/ProjectA/FileA1.txt"
104 # Test #5: Rename files + folders
105 # * Test rename support
106 # * Create complex find-ancestors case, where files are renamed within a renamed folder on a branch
107 BRANCH
="$REPOURL/branches/test5"
108 svn copy
-q -m "Create branch" $TRUNK $BRANCH
109 svn switch
-q $BRANCH
111 svn
mv -q Module
/ProjectB Module
/ProjectC
112 svn
mv -q Module
/ProjectC
/FileB1.txt Module
/ProjectC
/FileC1.txt
113 echo "Module/ProjectC/FileC1.txt (Test 5)" >> $WC/Module
/ProjectC
/FileC1.txt
114 svn
mv -q Module
/ProjectC
/FileB2.txt Module
/ProjectC
/FileC2.txt
115 echo "Module/ProjectC/FileC2.txt (Test 5)" >> $WC/Module
/ProjectC
/FileC2.txt
116 svn_commit
"Test 5: Rename Module/ProjectB -> Module/ProjectC"
119 svn_commit
"Test 5: Rename Module/ProjectB -> Module/ProjectC"
121 # Test #6: Verify rename
122 BRANCH
="$REPOURL/branches/test6"
123 svn copy
-q -m "Create branch" $TRUNK $BRANCH
124 svn switch
-q $BRANCH
126 echo "Module/ProjectC/FileC1.txt (Test 6)" >> $WC/Module
/ProjectC
/FileC1.txt
127 echo "Module/ProjectC/FileC2.txt (Test 6)" >> $WC/Module
/ProjectC
/FileC2.txt
128 svn_commit
"Test 6: Verify Module/ProjectC/FileC*.txt"
131 svn_commit
"Test 6: Verify Module/ProjectC/FileC*.txt"
133 # Test #7: Rename files
134 # * Test rename support
135 # * Rename multiple files in the same folder
136 BRANCH
="$REPOURL/branches/test7"
137 svn copy
-q -m "Create branch" $TRUNK $BRANCH
138 svn switch
-q $BRANCH
140 svn
mv -q Module
/ProjectC
/FileC1.txt Module
/ProjectC
/FileC3.txt
141 echo "Module/ProjectC/FileC3.txt (Test 7)" >> $WC/Module
/ProjectC
/FileC3.txt
142 svn
mv -q Module
/ProjectC
/FileC2.txt Module
/ProjectC
/FileC4.txt
143 echo "Module/ProjectC/FileC4.txt (Test 7)" >> $WC/Module
/ProjectC
/FileC4.txt
144 svn_commit
"Test 7: Rename Module/ProjectC/FileC*.txt"
147 svn_commit
"Test 7: Rename Module/ProjectC/FileC*.txt"
149 # Test #8: Verify rename
150 BRANCH
="$REPOURL/branches/test8"
151 svn copy
-q -m "Create branch" $TRUNK $BRANCH
152 svn switch
-q $BRANCH
154 echo "Module/ProjectC/FileC3.txt (Test 8)" >> $WC/Module
/ProjectC
/FileC3.txt
155 echo "Module/ProjectC/FileC4.txt (Test 8)" >> $WC/Module
/ProjectC
/FileC4.txt
156 svn_commit
"Test 8: Verify Module/ProjectC/FileC*.txt"
159 svn_commit
"Test 8: Verify Module/ProjectC/FileC*.txt"
161 # Test #9: Copy from older revision
162 svn copy
-q -r 8 $TRUNK/Module
/ProjectA
/FileA2.txt@
8 $WC/Module
/ProjectA
/FileA2.txt
163 svn propdel
-q svn
:mergeinfo Module
/ProjectA
/FileA2.txt
164 svn_commit
"Test 9: Restore Module/ProjectA/FileA2.txt"
166 # Test #10: Verify copy
167 BRANCH
="$REPOURL/branches/test10"
168 svn copy
-q -m "Create branch" $TRUNK $BRANCH
169 svn switch
-q $BRANCH
171 echo "Module/ProjectA/FileA2.txt (Test 10)" >> $WC/Module
/ProjectA
/FileA2.txt
172 svn_commit
"Test 10: Verify Module/ProjectA/FileA2.txt"
175 svn_commit
"Test 10: Verify Module/ProjectA/FileA2.txt"
177 # Test #11: Rename files + folders, multiple chained renames
178 # * Test rename support
179 # * Create complicated find-ancestors case, where files/folders are renamed multiple times on branch
180 BRANCH
="$REPOURL/branches/test11"
181 svn copy
-q -m "Create branch" $TRUNK $BRANCH
182 svn switch
-q $BRANCH
184 svn
mv -q Module
/ProjectC Module
/ProjectD
185 svn
mv -q Module
/ProjectD
/FileC3.txt Module
/ProjectD
/FileD1.txt
186 echo "Module/ProjectD/FileD1.txt (Test 11)" >> $WC/Module
/ProjectD
/FileD1.txt
187 svn
mv -q Module
/ProjectD
/FileC4.txt Module
/ProjectD
/FileD2.txt
188 echo "Module/ProjectD/FileD2.txt (Test 11)" >> $WC/Module
/ProjectD
/FileD2.txt
189 svn_commit
"Test 11: Rename Module/ProjectC -> Module/ProjectD (part 1 of 2)" Module
/ProjectC Module
/ProjectD
/FileC3.txt Module
/ProjectD
/FileC4.txt
190 svn_commit
"Test 11: Rename Module/ProjectC -> Module/ProjectD (part 2 of 2)"
191 BRANCH
="$REPOURL/branches/test11-1"
192 svn copy
-q -m "Create branch" $TRUNK $BRANCH
193 svn switch
-q $BRANCH
195 svn merge
-q $REPOURL/branches
/test11
196 svn_commit
"Test 11: Re-branch"
197 svn
mv -q Module
/ProjectD Module
/ProjectE
198 svn
mv -q Module
/ProjectE
/FileD1.txt Module
/ProjectE
/FileE1.txt
199 echo "Module/ProjectE/FileE1.txt (Test 11-1)" >> $WC/Module
/ProjectE
/FileE1.txt
200 svn
mv -q Module
/ProjectE
/FileD2.txt Module
/ProjectE
/FileE2.txt
201 echo "Module/ProjectE/FileE2.txt (Test 11-1)" >> $WC/Module
/ProjectE
/FileE2.txt
202 svn_commit
"Test 11: Rename Module/ProjectD -> Module/ProjectE (part 1 of 2)" Module
/ProjectD Module
/ProjectE
/FileD1.txt Module
/ProjectE
/FileD2.txt
203 svn_commit
"Test 11: Rename Module/ProjectD -> Module/ProjectE (part 2 of 2)"
206 svn_commit
"Test 11: Rename Module/ProjectC -> Module/ProjectE"
208 # Test #12: Verify renames
209 BRANCH
="$REPOURL/branches/test12"
210 svn copy
-q -m "Create branch" $TRUNK $BRANCH
211 svn switch
-q $BRANCH
213 echo "Module/ProjectE/FileE1.txt (Test 12)" >> $WC/Module
/ProjectE
/FileE1.txt
214 echo "Module/ProjectE/FileE2.txt (Test 12)" >> $WC/Module
/ProjectE
/FileE2.txt
215 svn_commit
"Test 12: Verify Module/ProjectE/FileE*.txt"
218 svn_commit
"Test 12: Verify Module/ProjectE/FileE*.txt"
220 # Test #13: Replaces and add's inside a parent renamed folder.
221 BRANCH
="$REPOURL/branches/test13"
222 svn copy
-q -m "Create branch" $TRUNK $BRANCH
223 svn switch
-q $BRANCH
225 svn copy
-q Module
/ProjectA Module
/ProjectB
226 echo "Module/ProjectB/FileA1.txt (Test 13-1)" >> $WC/Module
/ProjectB
/FileA1.txt
227 echo "Module/ProjectB/FileA2.txt (Test 13-1)" >> $WC/Module
/ProjectB
/FileA2.txt
228 svn_commit
"Test 13: Copy Module/ProjectA -> Module/ProjectB"
229 svn
mv -q Module
/ProjectB
/FileA1.txt Module
/ProjectB
/FileB1.txt
230 echo "Module/ProjectB/FileB1.txt (Test 13-2)" >> $WC/Module
/ProjectB
/FileB1.txt
231 svn
mv -q Module
/ProjectB
/FileA2.txt Module
/ProjectB
/FileB2.txt
232 echo "Module/ProjectB/FileB2.txt (Test 13-2)" >> $WC/Module
/ProjectB
/FileB2.txt
233 svn_commit
"Test 13: Rename Module/ProjectB/FileA*.txt -> FileB*.txt"
234 svn copy
-q Module
/ProjectB
/FileB2.txt Module
/ProjectB
/FileB3.txt
235 echo "Module/ProjectB/FileB3.txt (Test 13-3)" >> $WC/Module
/ProjectB
/FileB3.txt
236 svn
rm -q Module
/ProjectB
/FileB1.txt
237 echo "Module/ProjectB/FileB1.txt (Test 13-3 - Replaced)" >> $WC/Module
/ProjectB
/FileB1.txt
238 svn add
-q Module
/ProjectB
/FileB1.txt
239 svn_commit
"Test 13: Edits to Module/ProjectB/FileB*.txt"
242 svn_commit
"Test 13: Create Module/ProjectB from Module/ProjectA"
244 # Test #14: Verify renames
245 BRANCH
="$REPOURL/branches/test14"
246 svn copy
-q -m "Create branch" $TRUNK $BRANCH
247 svn switch
-q $BRANCH
249 echo "Module/ProjectB/FileB1.txt (Test 14)" >> $WC/Module
/ProjectB
/FileB1.txt
250 echo "Module/ProjectB/FileB2.txt (Test 14)" >> $WC/Module
/ProjectB
/FileB2.txt
251 echo "Module/ProjectB/FileB3.txt (Test 14)" >> $WC/Module
/ProjectB
/FileB3.txt
252 svn_commit
"Test 14: Verify Module/ProjectB/FileB*.txt"
255 svn_commit
"Test 14: Verify Module/ProjectB/FileB*.txt"
257 # Test #15: Replace copy-from
258 BRANCH
="$REPOURL/branches/test15"
259 svn copy
-q -m "Create branch" $TRUNK $BRANCH
260 svn switch
-q $BRANCH
262 svn
rm -q Module
/ProjectB
/FileB2.txt
263 svn copy
-q -r 22 $TRUNK/Module
/ProjectC
/FileC1.txt@
22 Module
/ProjectB
/FileB2.txt
264 echo "Module/ProjectB/FileB2.txt (Test 15 - Replaced)" >> $WC/Module
/ProjectB
/FileB2.txt
265 svn_commit
"Test 15: Replace Module/ProjectB/FileB2.txt from earlier Module/ProjectC/FileC1.txt"
268 svn_commit
"Test 15: Replace Module/ProjectB/FileB2.txt from earlier Module/ProjectC/FileC1.txt"
270 # Test #16: Verify replace
271 BRANCH
="$REPOURL/branches/test16"
272 svn copy
-q -m "Create branch" $TRUNK $BRANCH
273 svn switch
-q $BRANCH
275 echo "Module/ProjectB/FileB2.txt (Test 16)" >> $WC/Module
/ProjectB
/FileB2.txt
276 svn_commit
"Test 16: Verify Module/ProjectB/FileB2.txt"
279 svn_commit
"Test 16: Verify Module/ProjectB/FileB2.txt"
281 # Test #17: Copy-from replaces and add's inside top-level initial-add folder
282 BRANCH
="$REPOURL/branches/test17"
283 svn copy
-q -m "Create branch" $TRUNK $BRANCH
284 svn switch
-q $BRANCH
287 svn copy
-q Module
/ProjectB Module
2/ProjectB
288 echo "Module2/ProjectB/FileB1.txt (Test 17-1)" >> $WC/Module
2/ProjectB
/FileB1.txt
289 echo "Module2/ProjectB/FileB2.txt (Test 17-1)" >> $WC/Module
2/ProjectB
/FileB2.txt
290 echo "Module2/ProjectB/FileB3.txt (Test 17-1)" >> $WC/Module
2/ProjectB
/FileB3.txt
291 svn_commit
"Test 17: Copy Module/ProjectB -> Module2/ProjectB"
292 svn
rm -q Module
2/ProjectB
/FileB1.txt
293 svn copy
-q -r 22 $TRUNK/Module
/ProjectC
/FileC2.txt@
22 Module
2/ProjectB
/FileB1.txt
294 echo "Module2/ProjectB/FileB1.txt (Test 17-2)" >> $WC/Module
2/ProjectB
/FileB1.txt
295 svn_commit
"Test 17: Replace Module2/ProjectB/FileB1.txt from earlier Module/ProjectC/FileC2.txt"
298 svn_commit
"Test 17: Create Module2/ProjectB from Module/ProjectB"
301 echo "Cleaning-up..."