]>
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 BRANCH
="$REPOURL/branches/test3"
90 svn copy
-q -m "Create branch" $TRUNK $BRANCH
93 echo "Module/ProjectB/FileB2.txt (Test 3)" >> $WC/Module
/ProjectB
/FileB2.txt
94 svn propset
-q filename FileB2.txt
$WC/Module
/ProjectB
/FileB2.txt
95 svn_commit
"Test 3: Verify Module/ProjectB/FileB2.txt"
98 svn_commit
"Test 3: Verify Module/ProjectB/FileB2.txt"
100 # Test #4: Replace files
101 # * Test replace support
102 BRANCH
="$REPOURL/branches/test4"
103 svn copy
-q -m "Create branch" $TRUNK $BRANCH
104 svn switch
-q $BRANCH
106 svn
rm -q Module
/ProjectA
/FileA1.txt
107 echo "Module/ProjectA/FileA1.txt (Test 4 - Replaced)" >> $WC/Module
/ProjectA
/FileA1.txt
108 svn add
-q Module
/ProjectA
/FileA1.txt
109 svn_commit
"Test 4: Replace Module/ProjectA/FileA1.txt"
112 svn_commit
"Test 4: Replace Module/ProjectA/FileA1.txt"
114 # Test #5: Rename files + folders
115 # * Test rename support
116 # * Create complex find-ancestors case, where files are renamed within a renamed folder on a branch
117 # * Test propset and propdel
118 BRANCH
="$REPOURL/branches/test5"
119 svn copy
-q -m "Create branch" $TRUNK $BRANCH
120 svn switch
-q $BRANCH
122 svn
mv -q Module
/ProjectB Module
/ProjectC
123 svn
mv -q Module
/ProjectC
/FileB1.txt Module
/ProjectC
/FileC1.txt
124 echo "Module/ProjectC/FileC1.txt (Test 5)" >> $WC/Module
/ProjectC
/FileC1.txt
125 svn propdel
-q filename
$WC/Module
/ProjectC
/FileC1.txt
126 svn propset
-q desc
'This is a long string
127 broken on two lines...' $WC/Module
/ProjectC
/FileC1.txt
128 svn
mv -q Module
/ProjectC
/FileB2.txt Module
/ProjectC
/FileC2.txt
129 svn propset
-q filename FileC2.txt
$WC/Module
/ProjectC
/FileC2.txt
130 echo "Module/ProjectC/FileC2.txt (Test 5)" >> $WC/Module
/ProjectC
/FileC2.txt
131 svn_commit
"Test 5: Rename Module/ProjectB -> Module/ProjectC"
134 svn_commit
"Test 5: Rename Module/ProjectB -> Module/ProjectC"
136 # Test #6: Verify rename
137 BRANCH
="$REPOURL/branches/test6"
138 svn copy
-q -m "Create branch" $TRUNK $BRANCH
139 svn switch
-q $BRANCH
141 echo "Module/ProjectC/FileC1.txt (Test 6)" >> $WC/Module
/ProjectC
/FileC1.txt
142 echo "Module/ProjectC/FileC2.txt (Test 6)" >> $WC/Module
/ProjectC
/FileC2.txt
143 svn_commit
"Test 6: Verify Module/ProjectC/FileC*.txt"
146 svn_commit
"Test 6: Verify Module/ProjectC/FileC*.txt"
148 # Test #7: Rename files
149 # * Test rename support
150 # * Rename multiple files in the same folder
151 BRANCH
="$REPOURL/branches/test7"
152 svn copy
-q -m "Create branch" $TRUNK $BRANCH
153 svn switch
-q $BRANCH
155 svn
mv -q Module
/ProjectC
/FileC1.txt Module
/ProjectC
/FileC3.txt
156 echo "Module/ProjectC/FileC3.txt (Test 7)" >> $WC/Module
/ProjectC
/FileC3.txt
157 svn
mv -q Module
/ProjectC
/FileC2.txt Module
/ProjectC
/FileC4.txt
158 echo "Module/ProjectC/FileC4.txt (Test 7)" >> $WC/Module
/ProjectC
/FileC4.txt
159 svn_commit
"Test 7: Rename Module/ProjectC/FileC*.txt"
162 svn_commit
"Test 7: Rename Module/ProjectC/FileC*.txt"
164 # Test #8: Verify rename
165 BRANCH
="$REPOURL/branches/test8"
166 svn copy
-q -m "Create branch" $TRUNK $BRANCH
167 svn switch
-q $BRANCH
169 echo "Module/ProjectC/FileC3.txt (Test 8)" >> $WC/Module
/ProjectC
/FileC3.txt
170 echo "Module/ProjectC/FileC4.txt (Test 8)" >> $WC/Module
/ProjectC
/FileC4.txt
171 svn_commit
"Test 8: Verify Module/ProjectC/FileC*.txt"
174 svn_commit
"Test 8: Verify Module/ProjectC/FileC*.txt"
176 # Test #9: Copy from older revision
177 svn copy
-q -r 8 $TRUNK/Module
/ProjectA
/FileA2.txt@
8 $WC/Module
/ProjectA
/FileA2.txt
178 svn propdel
-q svn
:mergeinfo Module
/ProjectA
/FileA2.txt
179 svn_commit
"Test 9: Restore Module/ProjectA/FileA2.txt"
181 # Test #10: Verify copy
182 BRANCH
="$REPOURL/branches/test10"
183 svn copy
-q -m "Create branch" $TRUNK $BRANCH
184 svn switch
-q $BRANCH
186 echo "Module/ProjectA/FileA2.txt (Test 10)" >> $WC/Module
/ProjectA
/FileA2.txt
187 svn_commit
"Test 10: Verify Module/ProjectA/FileA2.txt"
190 svn_commit
"Test 10: Verify Module/ProjectA/FileA2.txt"
192 # Test #11: Rename files + folders, multiple chained renames
193 # * Test rename support
194 # * Create complicated find-ancestors case, where files/folders are renamed multiple times on branch
195 BRANCH
="$REPOURL/branches/test11"
196 svn copy
-q -m "Create branch" $TRUNK $BRANCH
197 svn switch
-q $BRANCH
199 svn
mv -q Module
/ProjectC Module
/ProjectD
200 svn
mv -q Module
/ProjectD
/FileC3.txt Module
/ProjectD
/FileD1.txt
201 echo "Module/ProjectD/FileD1.txt (Test 11)" >> $WC/Module
/ProjectD
/FileD1.txt
202 svn
mv -q Module
/ProjectD
/FileC4.txt Module
/ProjectD
/FileD2.txt
203 echo "Module/ProjectD/FileD2.txt (Test 11)" >> $WC/Module
/ProjectD
/FileD2.txt
204 svn_commit
"Test 11: Rename Module/ProjectC -> Module/ProjectD (part 1 of 2)" Module
/ProjectC Module
/ProjectD
/FileC3.txt Module
/ProjectD
/FileC4.txt
205 svn_commit
"Test 11: Rename Module/ProjectC -> Module/ProjectD (part 2 of 2)"
206 BRANCH
="$REPOURL/branches/test11-1"
207 svn copy
-q -m "Create branch" $TRUNK $BRANCH
208 svn switch
-q $BRANCH
210 svn merge
-q $REPOURL/branches
/test11
211 svn_commit
"Test 11: Re-branch"
212 svn
mv -q Module
/ProjectD Module
/ProjectE
213 svn
mv -q Module
/ProjectE
/FileD1.txt Module
/ProjectE
/FileE1.txt
214 echo "Module/ProjectE/FileE1.txt (Test 11-1)" >> $WC/Module
/ProjectE
/FileE1.txt
215 svn
mv -q Module
/ProjectE
/FileD2.txt Module
/ProjectE
/FileE2.txt
216 echo "Module/ProjectE/FileE2.txt (Test 11-1)" >> $WC/Module
/ProjectE
/FileE2.txt
217 svn_commit
"Test 11: Rename Module/ProjectD -> Module/ProjectE (part 1 of 2)" Module
/ProjectD Module
/ProjectE
/FileD1.txt Module
/ProjectE
/FileD2.txt
218 svn_commit
"Test 11: Rename Module/ProjectD -> Module/ProjectE (part 2 of 2)"
221 svn_commit
"Test 11: Rename Module/ProjectC -> Module/ProjectE"
223 # Test #12: Verify renames
224 BRANCH
="$REPOURL/branches/test12"
225 svn copy
-q -m "Create branch" $TRUNK $BRANCH
226 svn switch
-q $BRANCH
228 echo "Module/ProjectE/FileE1.txt (Test 12)" >> $WC/Module
/ProjectE
/FileE1.txt
229 echo "Module/ProjectE/FileE2.txt (Test 12)" >> $WC/Module
/ProjectE
/FileE2.txt
230 svn_commit
"Test 12: Verify Module/ProjectE/FileE*.txt"
233 svn_commit
"Test 12: Verify Module/ProjectE/FileE*.txt"
235 # Test #13: Replaces and add's inside a parent renamed folder.
236 BRANCH
="$REPOURL/branches/test13"
237 svn copy
-q -m "Create branch" $TRUNK $BRANCH
238 svn switch
-q $BRANCH
240 svn copy
-q Module
/ProjectA Module
/ProjectB
241 echo "Module/ProjectB/FileA1.txt (Test 13-1)" >> $WC/Module
/ProjectB
/FileA1.txt
242 echo "Module/ProjectB/FileA2.txt (Test 13-1)" >> $WC/Module
/ProjectB
/FileA2.txt
243 svn_commit
"Test 13: Copy Module/ProjectA -> Module/ProjectB"
244 svn
mv -q Module
/ProjectB
/FileA1.txt Module
/ProjectB
/FileB1.txt
245 echo "Module/ProjectB/FileB1.txt (Test 13-2)" >> $WC/Module
/ProjectB
/FileB1.txt
246 svn
mv -q Module
/ProjectB
/FileA2.txt Module
/ProjectB
/FileB2.txt
247 echo "Module/ProjectB/FileB2.txt (Test 13-2)" >> $WC/Module
/ProjectB
/FileB2.txt
248 svn_commit
"Test 13: Rename Module/ProjectB/FileA*.txt -> FileB*.txt"
249 svn copy
-q Module
/ProjectB
/FileB2.txt Module
/ProjectB
/FileB3.txt
250 echo "Module/ProjectB/FileB3.txt (Test 13-3)" >> $WC/Module
/ProjectB
/FileB3.txt
251 svn
rm -q Module
/ProjectB
/FileB1.txt
252 echo "Module/ProjectB/FileB1.txt (Test 13-3 - Replaced)" >> $WC/Module
/ProjectB
/FileB1.txt
253 svn add
-q Module
/ProjectB
/FileB1.txt
254 svn_commit
"Test 13: Edits to Module/ProjectB/FileB*.txt"
257 svn_commit
"Test 13: Create Module/ProjectB from Module/ProjectA"
259 # Test #14: Verify renames
260 BRANCH
="$REPOURL/branches/test14"
261 svn copy
-q -m "Create branch" $TRUNK $BRANCH
262 svn switch
-q $BRANCH
264 echo "Module/ProjectB/FileB1.txt (Test 14)" >> $WC/Module
/ProjectB
/FileB1.txt
265 echo "Module/ProjectB/FileB2.txt (Test 14)" >> $WC/Module
/ProjectB
/FileB2.txt
266 echo "Module/ProjectB/FileB3.txt (Test 14)" >> $WC/Module
/ProjectB
/FileB3.txt
267 svn_commit
"Test 14: Verify Module/ProjectB/FileB*.txt"
270 svn_commit
"Test 14: Verify Module/ProjectB/FileB*.txt"
272 # Test #15: Replace copy-from
273 BRANCH
="$REPOURL/branches/test15"
274 svn copy
-q -m "Create branch" $TRUNK $BRANCH
275 svn switch
-q $BRANCH
277 svn
rm -q Module
/ProjectB
/FileB2.txt
278 svn copy
-q -r 22 $TRUNK/Module
/ProjectC
/FileC1.txt@
22 Module
/ProjectB
/FileB2.txt
279 echo "Module/ProjectB/FileB2.txt (Test 15 - Replaced)" >> $WC/Module
/ProjectB
/FileB2.txt
280 svn_commit
"Test 15: Replace Module/ProjectB/FileB2.txt from earlier Module/ProjectC/FileC1.txt"
283 svn_commit
"Test 15: Replace Module/ProjectB/FileB2.txt from earlier Module/ProjectC/FileC1.txt"
285 # Test #16: Verify replace
286 BRANCH
="$REPOURL/branches/test16"
287 svn copy
-q -m "Create branch" $TRUNK $BRANCH
288 svn switch
-q $BRANCH
290 echo "Module/ProjectB/FileB2.txt (Test 16)" >> $WC/Module
/ProjectB
/FileB2.txt
291 svn_commit
"Test 16: Verify Module/ProjectB/FileB2.txt"
294 svn_commit
"Test 16: Verify Module/ProjectB/FileB2.txt"
296 # Test #17: Copy-from replaces and add's inside top-level initial-add folder
297 BRANCH
="$REPOURL/branches/test17"
298 svn copy
-q -m "Create branch" $TRUNK $BRANCH
299 svn switch
-q $BRANCH
302 svn copy
-q Module
/ProjectB Module
2/ProjectB
303 echo "Module2/ProjectB/FileB1.txt (Test 17-1)" >> $WC/Module
2/ProjectB
/FileB1.txt
304 echo "Module2/ProjectB/FileB2.txt (Test 17-1)" >> $WC/Module
2/ProjectB
/FileB2.txt
305 echo "Module2/ProjectB/FileB3.txt (Test 17-1)" >> $WC/Module
2/ProjectB
/FileB3.txt
306 svn_commit
"Test 17: Copy Module/ProjectB -> Module2/ProjectB"
307 svn
rm -q Module
2/ProjectB
/FileB1.txt
308 svn copy
-q -r 22 $TRUNK/Module
/ProjectC
/FileC2.txt@
22 Module
2/ProjectB
/FileB1.txt
309 echo "Module2/ProjectB/FileB1.txt (Test 17-2)" >> $WC/Module
2/ProjectB
/FileB1.txt
310 svn_commit
"Test 17: Replace Module2/ProjectB/FileB1.txt from earlier Module/ProjectC/FileC2.txt"
313 svn_commit
"Test 17: Create Module2/ProjectB from Module/ProjectB"
316 echo "Cleaning-up..."