]>
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 propset
-q desc
"FileA1.txt" $WC/Module
/ProjectA
/FileA1.txt
47 svn propset
-q desc
"FileA2.txt" $WC/Module
/ProjectA
/FileA2.txt
48 svn_commit
"Initial population"
50 # Test #1: Add new file
51 # * Test simple copy-from branch
53 BRANCH
="$REPOURL/branches/test1"
54 svn copy
-q -m "Create branch" $TRUNK $BRANCH
57 mkdir -p $WC/Module
/ProjectB
58 echo "Module/ProjectB/FileB1.txt (Test 1)" >> $WC/Module
/ProjectB
/FileB1.txt
59 svn add
-q $WC/Module
/ProjectB
60 svn propset
-q filename FileB1.txt
$WC/Module
/ProjectB
/FileB1.txt
61 svn_commit
"Test 1: Add Module/ProjectB"
64 svn ci
-q --with-revprop 'testprop=Test 1 message' -m "Test 1: Add Module/ProjectB"
68 # Empty commit message
69 echo "Module/ProjectB/FileB1.txt (Test 1.1)" >> $WC/Module
/ProjectB
/FileB1.txt
72 # Test #2: Rename files
73 # * Test rename support
74 # * Test committing rename in two different branch commits: first deletion, then add
75 # * Test props from copy-from file carry forward to target
76 BRANCH
="$REPOURL/branches/test2"
77 svn copy
-q -m "Create branch" $TRUNK $BRANCH
80 svn
mv -q Module
/ProjectA
/FileA2.txt Module
/ProjectB
/FileB2.txt
81 echo "Module/ProjectB/FileB2.txt (Test 2)" >> $WC/Module
/ProjectB
/FileB2.txt
82 svn_commit
"Test 2: Rename Module/ProjectA/FileA2.txt -> Module/ProjectB/FileB2.txt (part 1 of 2)" Module
/ProjectA
83 svn_commit
"Test 2: Rename Module/ProjectA/FileA2.txt -> Module/ProjectB/FileB2.txt (part 2 of 2)" Module
/ProjectB
86 svn_commit
"Test 2: Rename Module/ProjectA/FileA2.txt -> Module/ProjectB/FileB3.txt"
88 # Test #3: Verify rename
89 # * Test svn:mergeinfo-only change
90 BRANCH
="$REPOURL/branches/test3"
91 svn copy
-q -m "Create branch" $TRUNK $BRANCH
94 echo "Module/ProjectB/FileB2.txt (Test 3)" >> $WC/Module
/ProjectB
/FileB2.txt
95 svn propset
-q filename FileB2.txt
$WC/Module
/ProjectB
/FileB2.txt
96 svn propset
-q 'svn:mergeinfo' '/branches/foo/Module/ProjectB/FileB1.txt:5' $WC/Module
/ProjectB
/FileB1.txt
97 svn propset
-q 'svn:mergeinfo' '/branches/foo/Module/ProjectB/FileB2.txt:5' $WC/Module
/ProjectB
/FileB2.txt
98 svn_commit
"Test 3: Verify Module/ProjectB/FileB2.txt"
101 svn_commit
"Test 3: Verify Module/ProjectB/FileB2.txt"
103 # Test #4: Replace files
104 # * Test replace support
105 BRANCH
="$REPOURL/branches/test4"
106 svn copy
-q -m "Create branch" $TRUNK $BRANCH
107 svn switch
-q $BRANCH
109 svn
rm -q Module
/ProjectA
/FileA1.txt
110 echo "Module/ProjectA/FileA1.txt (Test 4 - Replaced)" >> $WC/Module
/ProjectA
/FileA1.txt
111 svn add
-q Module
/ProjectA
/FileA1.txt
112 svn_commit
"Test 4: Replace Module/ProjectA/FileA1.txt"
115 svn_commit
"Test 4: Replace Module/ProjectA/FileA1.txt"
117 # Test #5: Rename files + folders
118 # * Test rename support
119 # * Create complex find-ancestors case, where files are renamed within a renamed folder on a branch
120 # * Test propset and propdel
121 BRANCH
="$REPOURL/branches/test5"
122 svn copy
-q -m "Create branch" $TRUNK $BRANCH
123 svn switch
-q $BRANCH
125 svn
mv -q Module
/ProjectB Module
/ProjectC
126 svn
mv -q Module
/ProjectC
/FileB1.txt Module
/ProjectC
/FileC1.txt
127 echo "Module/ProjectC/FileC1.txt (Test 5)" >> $WC/Module
/ProjectC
/FileC1.txt
128 svn propdel
-q filename
$WC/Module
/ProjectC
/FileC1.txt
129 svn propset
-q desc
'This is a long string
130 broken on two lines...' $WC/Module
/ProjectC
/FileC1.txt
131 svn
mv -q Module
/ProjectC
/FileB2.txt Module
/ProjectC
/FileC2.txt
132 svn propset
-q filename FileC2.txt
$WC/Module
/ProjectC
/FileC2.txt
133 echo "Module/ProjectC/FileC2.txt (Test 5)" >> $WC/Module
/ProjectC
/FileC2.txt
134 svn_commit
"Test 5: Rename Module/ProjectB -> Module/ProjectC"
137 svn_commit
"Test 5: Rename Module/ProjectB -> Module/ProjectC"
139 # Test #6: Verify rename
140 BRANCH
="$REPOURL/branches/test6"
141 svn copy
-q -m "Create branch" $TRUNK $BRANCH
142 svn switch
-q $BRANCH
144 echo "Module/ProjectC/FileC1.txt (Test 6)" >> $WC/Module
/ProjectC
/FileC1.txt
145 echo "Module/ProjectC/FileC2.txt (Test 6)" >> $WC/Module
/ProjectC
/FileC2.txt
146 svn_commit
"Test 6: Verify Module/ProjectC/FileC*.txt"
149 svn_commit
"Test 6: Verify Module/ProjectC/FileC*.txt"
151 # Test #7: Rename files
152 # * Test rename support
153 # * Rename multiple files in the same folder
154 BRANCH
="$REPOURL/branches/test7"
155 svn copy
-q -m "Create branch" $TRUNK $BRANCH
156 svn switch
-q $BRANCH
158 svn
mv -q Module
/ProjectC
/FileC1.txt Module
/ProjectC
/FileC3.txt
159 echo "Module/ProjectC/FileC3.txt (Test 7)" >> $WC/Module
/ProjectC
/FileC3.txt
160 svn
mv -q Module
/ProjectC
/FileC2.txt Module
/ProjectC
/FileC4.txt
161 echo "Module/ProjectC/FileC4.txt (Test 7)" >> $WC/Module
/ProjectC
/FileC4.txt
162 svn_commit
"Test 7: Rename Module/ProjectC/FileC*.txt"
165 svn_commit
"Test 7: Rename Module/ProjectC/FileC*.txt"
167 # Test #8: Verify rename
168 BRANCH
="$REPOURL/branches/test8"
169 svn copy
-q -m "Create branch" $TRUNK $BRANCH
170 svn switch
-q $BRANCH
172 echo "Module/ProjectC/FileC3.txt (Test 8)" >> $WC/Module
/ProjectC
/FileC3.txt
173 echo "Module/ProjectC/FileC4.txt (Test 8)" >> $WC/Module
/ProjectC
/FileC4.txt
174 svn_commit
"Test 8: Verify Module/ProjectC/FileC*.txt"
177 svn_commit
"Test 8: Verify Module/ProjectC/FileC*.txt"
179 # Test #9: Copy from older revision
180 svn copy
-q -r 8 $TRUNK/Module
/ProjectA
/FileA2.txt@
8 $WC/Module
/ProjectA
/FileA2.txt
181 svn propdel
-q svn
:mergeinfo Module
/ProjectA
/FileA2.txt
182 svn_commit
"Test 9: Restore Module/ProjectA/FileA2.txt"
184 # Test #10: Verify copy
185 BRANCH
="$REPOURL/branches/test10"
186 svn copy
-q -m "Create branch" $TRUNK $BRANCH
187 svn switch
-q $BRANCH
189 echo "Module/ProjectA/FileA2.txt (Test 10)" >> $WC/Module
/ProjectA
/FileA2.txt
190 svn_commit
"Test 10: Verify Module/ProjectA/FileA2.txt"
193 svn_commit
"Test 10: Verify Module/ProjectA/FileA2.txt"
195 # Test #11: Rename files + folders, multiple chained renames
196 # * Test rename support
197 # * Create complicated find-ancestors case, where files/folders are renamed multiple times on branch
198 BRANCH
="$REPOURL/branches/test11"
199 svn copy
-q -m "Create branch" $TRUNK $BRANCH
200 svn switch
-q $BRANCH
202 svn
mv -q Module
/ProjectC Module
/ProjectD
203 svn
mv -q Module
/ProjectD
/FileC3.txt Module
/ProjectD
/FileD1.txt
204 echo "Module/ProjectD/FileD1.txt (Test 11)" >> $WC/Module
/ProjectD
/FileD1.txt
205 svn
mv -q Module
/ProjectD
/FileC4.txt Module
/ProjectD
/FileD2.txt
206 echo "Module/ProjectD/FileD2.txt (Test 11)" >> $WC/Module
/ProjectD
/FileD2.txt
207 svn_commit
"Test 11: Rename Module/ProjectC -> Module/ProjectD (part 1 of 2)" Module
/ProjectC Module
/ProjectD
/FileC3.txt Module
/ProjectD
/FileC4.txt
208 svn_commit
"Test 11: Rename Module/ProjectC -> Module/ProjectD (part 2 of 2)"
209 BRANCH
="$REPOURL/branches/test11-1"
210 svn copy
-q -m "Create branch" $TRUNK $BRANCH
211 svn switch
-q $BRANCH
213 svn merge
-q $REPOURL/branches
/test11
214 svn_commit
"Test 11: Re-branch"
215 svn
mv -q Module
/ProjectD Module
/ProjectE
216 svn
mv -q Module
/ProjectE
/FileD1.txt Module
/ProjectE
/FileE1.txt
217 echo "Module/ProjectE/FileE1.txt (Test 11-1)" >> $WC/Module
/ProjectE
/FileE1.txt
218 svn
mv -q Module
/ProjectE
/FileD2.txt Module
/ProjectE
/FileE2.txt
219 echo "Module/ProjectE/FileE2.txt (Test 11-1)" >> $WC/Module
/ProjectE
/FileE2.txt
220 svn_commit
"Test 11: Rename Module/ProjectD -> Module/ProjectE (part 1 of 2)" Module
/ProjectD Module
/ProjectE
/FileD1.txt Module
/ProjectE
/FileD2.txt
221 svn_commit
"Test 11: Rename Module/ProjectD -> Module/ProjectE (part 2 of 2)"
224 svn_commit
"Test 11: Rename Module/ProjectC -> Module/ProjectE"
226 # Test #12: Verify renames
227 BRANCH
="$REPOURL/branches/test12"
228 svn copy
-q -m "Create branch" $TRUNK $BRANCH
229 svn switch
-q $BRANCH
231 echo "Module/ProjectE/FileE1.txt (Test 12)" >> $WC/Module
/ProjectE
/FileE1.txt
232 echo "Module/ProjectE/FileE2.txt (Test 12)" >> $WC/Module
/ProjectE
/FileE2.txt
233 svn_commit
"Test 12: Verify Module/ProjectE/FileE*.txt"
236 svn_commit
"Test 12: Verify Module/ProjectE/FileE*.txt"
238 # Test #13: Replaces and add's inside a parent renamed folder.
239 BRANCH
="$REPOURL/branches/test13"
240 svn copy
-q -m "Create branch" $TRUNK $BRANCH
241 svn switch
-q $BRANCH
243 svn copy
-q Module
/ProjectA Module
/ProjectB
244 echo "Module/ProjectB/FileA1.txt (Test 13-1)" >> $WC/Module
/ProjectB
/FileA1.txt
245 echo "Module/ProjectB/FileA2.txt (Test 13-1)" >> $WC/Module
/ProjectB
/FileA2.txt
246 svn_commit
"Test 13: Copy Module/ProjectA -> Module/ProjectB"
247 svn
mv -q Module
/ProjectB
/FileA1.txt Module
/ProjectB
/FileB1.txt
248 echo "Module/ProjectB/FileB1.txt (Test 13-2)" >> $WC/Module
/ProjectB
/FileB1.txt
249 svn
mv -q Module
/ProjectB
/FileA2.txt Module
/ProjectB
/FileB2.txt
250 echo "Module/ProjectB/FileB2.txt (Test 13-2)" >> $WC/Module
/ProjectB
/FileB2.txt
251 svn_commit
"Test 13: Rename Module/ProjectB/FileA*.txt -> FileB*.txt"
252 svn copy
-q Module
/ProjectB
/FileB2.txt Module
/ProjectB
/FileB3.txt
253 echo "Module/ProjectB/FileB3.txt (Test 13-3)" >> $WC/Module
/ProjectB
/FileB3.txt
254 svn
rm -q Module
/ProjectB
/FileB1.txt
255 echo "Module/ProjectB/FileB1.txt (Test 13-3 - Replaced)" >> $WC/Module
/ProjectB
/FileB1.txt
256 svn add
-q Module
/ProjectB
/FileB1.txt
257 svn_commit
"Test 13: Edits to Module/ProjectB/FileB*.txt"
260 svn_commit
"Test 13: Create Module/ProjectB from Module/ProjectA"
262 # Test #14: Verify renames
263 BRANCH
="$REPOURL/branches/test14"
264 svn copy
-q -m "Create branch" $TRUNK $BRANCH
265 svn switch
-q $BRANCH
267 echo "Module/ProjectB/FileB1.txt (Test 14)" >> $WC/Module
/ProjectB
/FileB1.txt
268 echo "Module/ProjectB/FileB2.txt (Test 14)" >> $WC/Module
/ProjectB
/FileB2.txt
269 echo "Module/ProjectB/FileB3.txt (Test 14)" >> $WC/Module
/ProjectB
/FileB3.txt
270 svn_commit
"Test 14: Verify Module/ProjectB/FileB*.txt"
273 svn_commit
"Test 14: Verify Module/ProjectB/FileB*.txt"
275 # Test #15: Replace copy-from
276 BRANCH
="$REPOURL/branches/test15"
277 svn copy
-q -m "Create branch" $TRUNK $BRANCH
278 svn switch
-q $BRANCH
280 svn
rm -q Module
/ProjectB
/FileB2.txt
281 svn copy
-q -r 22 $TRUNK/Module
/ProjectC
/FileC1.txt@
22 Module
/ProjectB
/FileB2.txt
282 echo "Module/ProjectB/FileB2.txt (Test 15 - Replaced)" >> $WC/Module
/ProjectB
/FileB2.txt
283 svn_commit
"Test 15: Replace Module/ProjectB/FileB2.txt from earlier Module/ProjectC/FileC1.txt"
286 svn_commit
"Test 15: Replace Module/ProjectB/FileB2.txt from earlier Module/ProjectC/FileC1.txt"
288 # Test #16: Verify replace
289 BRANCH
="$REPOURL/branches/test16"
290 svn copy
-q -m "Create branch" $TRUNK $BRANCH
291 svn switch
-q $BRANCH
293 echo "Module/ProjectB/FileB2.txt (Test 16)" >> $WC/Module
/ProjectB
/FileB2.txt
294 svn_commit
"Test 16: Verify Module/ProjectB/FileB2.txt"
297 svn_commit
"Test 16: Verify Module/ProjectB/FileB2.txt"
299 # Test #17: Copy-from replaces and add's inside top-level initial-add folder
300 BRANCH
="$REPOURL/branches/test17"
301 svn copy
-q -m "Create branch" $TRUNK $BRANCH
302 svn switch
-q $BRANCH
305 svn copy
-q Module
/ProjectB Module
2/ProjectB
306 echo "Module2/ProjectB/FileB1.txt (Test 17-1)" >> $WC/Module
2/ProjectB
/FileB1.txt
307 echo "Module2/ProjectB/FileB2.txt (Test 17-1)" >> $WC/Module
2/ProjectB
/FileB2.txt
308 echo "Module2/ProjectB/FileB3.txt (Test 17-1)" >> $WC/Module
2/ProjectB
/FileB3.txt
309 svn_commit
"Test 17: Copy Module/ProjectB -> Module2/ProjectB"
310 svn
rm -q Module
2/ProjectB
/FileB1.txt
311 svn copy
-q -r 22 $TRUNK/Module
/ProjectC
/FileC2.txt@
22 Module
2/ProjectB
/FileB1.txt
312 echo "Module2/ProjectB/FileB1.txt (Test 17-2)" >> $WC/Module
2/ProjectB
/FileB1.txt
313 svn_commit
"Test 17: Replace Module2/ProjectB/FileB1.txt from earlier Module/ProjectC/FileC2.txt"
316 svn_commit
"Test 17: Create Module2/ProjectB from Module/ProjectB"
319 echo "Cleaning-up..."