]>
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 # Empty commit message
65 echo "Module/ProjectB/FileB1.txt (Test 1.1)" >> $WC/Module
/ProjectB
/FileB1.txt
68 # Test #2: Rename files
69 # * Test rename support
70 # * Test committing rename in two different branch commits: first deletion, then add
71 BRANCH
="$REPOURL/branches/test2"
72 svn copy
-q -m "Create branch" $TRUNK $BRANCH
75 svn
mv -q Module
/ProjectA
/FileA2.txt Module
/ProjectB
/FileB2.txt
76 echo "Module/ProjectB/FileB2.txt (Test 2)" >> $WC/Module
/ProjectB
/FileB2.txt
77 svn_commit
"Test 2: Rename Module/ProjectA/FileA2.txt -> Module/ProjectB/FileB2.txt (part 1 of 2)" Module
/ProjectA
78 svn_commit
"Test 2: Rename Module/ProjectA/FileA2.txt -> Module/ProjectB/FileB2.txt (part 2 of 2)" Module
/ProjectB
81 svn_commit
"Test 2: Rename Module/ProjectA/FileA2.txt -> Module/ProjectB/FileB3.txt"
83 # Test #3: Verify rename
84 BRANCH
="$REPOURL/branches/test3"
85 svn copy
-q -m "Create branch" $TRUNK $BRANCH
88 echo "Module/ProjectB/FileB2.txt (Test 3)" >> $WC/Module
/ProjectB
/FileB2.txt
89 svn_commit
"Test 3: Verify Module/ProjectB/FileB2.txt"
92 svn_commit
"Test 3: Verify Module/ProjectB/FileB2.txt"
94 # Test #4: Replace files
95 # * Test replace support
96 BRANCH
="$REPOURL/branches/test4"
97 svn copy
-q -m "Create branch" $TRUNK $BRANCH
100 svn
rm -q Module
/ProjectA
/FileA1.txt
101 echo "Module/ProjectA/FileA1.txt (Test 4 - Replaced)" >> $WC/Module
/ProjectA
/FileA1.txt
102 svn add
-q Module
/ProjectA
/FileA1.txt
103 svn_commit
"Test 4: Replace Module/ProjectA/FileA1.txt"
106 svn_commit
"Test 4: Replace Module/ProjectA/FileA1.txt"
108 # Test #5: Rename files + folders
109 # * Test rename support
110 # * Create complex find-ancestors case, where files are renamed within a renamed folder on a branch
111 BRANCH
="$REPOURL/branches/test5"
112 svn copy
-q -m "Create branch" $TRUNK $BRANCH
113 svn switch
-q $BRANCH
115 svn
mv -q Module
/ProjectB Module
/ProjectC
116 svn
mv -q Module
/ProjectC
/FileB1.txt Module
/ProjectC
/FileC1.txt
117 echo "Module/ProjectC/FileC1.txt (Test 5)" >> $WC/Module
/ProjectC
/FileC1.txt
118 svn
mv -q Module
/ProjectC
/FileB2.txt Module
/ProjectC
/FileC2.txt
119 echo "Module/ProjectC/FileC2.txt (Test 5)" >> $WC/Module
/ProjectC
/FileC2.txt
120 svn_commit
"Test 5: Rename Module/ProjectB -> Module/ProjectC"
123 svn_commit
"Test 5: Rename Module/ProjectB -> Module/ProjectC"
125 # Test #6: Verify rename
126 BRANCH
="$REPOURL/branches/test6"
127 svn copy
-q -m "Create branch" $TRUNK $BRANCH
128 svn switch
-q $BRANCH
130 echo "Module/ProjectC/FileC1.txt (Test 6)" >> $WC/Module
/ProjectC
/FileC1.txt
131 echo "Module/ProjectC/FileC2.txt (Test 6)" >> $WC/Module
/ProjectC
/FileC2.txt
132 svn_commit
"Test 6: Verify Module/ProjectC/FileC*.txt"
135 svn_commit
"Test 6: Verify Module/ProjectC/FileC*.txt"
137 # Test #7: Rename files
138 # * Test rename support
139 # * Rename multiple files in the same folder
140 BRANCH
="$REPOURL/branches/test7"
141 svn copy
-q -m "Create branch" $TRUNK $BRANCH
142 svn switch
-q $BRANCH
144 svn
mv -q Module
/ProjectC
/FileC1.txt Module
/ProjectC
/FileC3.txt
145 echo "Module/ProjectC/FileC3.txt (Test 7)" >> $WC/Module
/ProjectC
/FileC3.txt
146 svn
mv -q Module
/ProjectC
/FileC2.txt Module
/ProjectC
/FileC4.txt
147 echo "Module/ProjectC/FileC4.txt (Test 7)" >> $WC/Module
/ProjectC
/FileC4.txt
148 svn_commit
"Test 7: Rename Module/ProjectC/FileC*.txt"
151 svn_commit
"Test 7: Rename Module/ProjectC/FileC*.txt"
153 # Test #8: Verify rename
154 BRANCH
="$REPOURL/branches/test8"
155 svn copy
-q -m "Create branch" $TRUNK $BRANCH
156 svn switch
-q $BRANCH
158 echo "Module/ProjectC/FileC3.txt (Test 8)" >> $WC/Module
/ProjectC
/FileC3.txt
159 echo "Module/ProjectC/FileC4.txt (Test 8)" >> $WC/Module
/ProjectC
/FileC4.txt
160 svn_commit
"Test 8: Verify Module/ProjectC/FileC*.txt"
163 svn_commit
"Test 8: Verify Module/ProjectC/FileC*.txt"
165 # Test #9: Copy from older revision
166 svn copy
-q -r 8 $TRUNK/Module
/ProjectA
/FileA2.txt@
8 $WC/Module
/ProjectA
/FileA2.txt
167 svn propdel
-q svn
:mergeinfo Module
/ProjectA
/FileA2.txt
168 svn_commit
"Test 9: Restore Module/ProjectA/FileA2.txt"
170 # Test #10: Verify copy
171 BRANCH
="$REPOURL/branches/test10"
172 svn copy
-q -m "Create branch" $TRUNK $BRANCH
173 svn switch
-q $BRANCH
175 echo "Module/ProjectA/FileA2.txt (Test 10)" >> $WC/Module
/ProjectA
/FileA2.txt
176 svn_commit
"Test 10: Verify Module/ProjectA/FileA2.txt"
179 svn_commit
"Test 10: Verify Module/ProjectA/FileA2.txt"
181 # Test #11: Rename files + folders, multiple chained renames
182 # * Test rename support
183 # * Create complicated find-ancestors case, where files/folders are renamed multiple times on branch
184 BRANCH
="$REPOURL/branches/test11"
185 svn copy
-q -m "Create branch" $TRUNK $BRANCH
186 svn switch
-q $BRANCH
188 svn
mv -q Module
/ProjectC Module
/ProjectD
189 svn
mv -q Module
/ProjectD
/FileC3.txt Module
/ProjectD
/FileD1.txt
190 echo "Module/ProjectD/FileD1.txt (Test 11)" >> $WC/Module
/ProjectD
/FileD1.txt
191 svn
mv -q Module
/ProjectD
/FileC4.txt Module
/ProjectD
/FileD2.txt
192 echo "Module/ProjectD/FileD2.txt (Test 11)" >> $WC/Module
/ProjectD
/FileD2.txt
193 svn_commit
"Test 11: Rename Module/ProjectC -> Module/ProjectD (part 1 of 2)" Module
/ProjectC Module
/ProjectD
/FileC3.txt Module
/ProjectD
/FileC4.txt
194 svn_commit
"Test 11: Rename Module/ProjectC -> Module/ProjectD (part 2 of 2)"
195 BRANCH
="$REPOURL/branches/test11-1"
196 svn copy
-q -m "Create branch" $TRUNK $BRANCH
197 svn switch
-q $BRANCH
199 svn merge
-q $REPOURL/branches
/test11
200 svn_commit
"Test 11: Re-branch"
201 svn
mv -q Module
/ProjectD Module
/ProjectE
202 svn
mv -q Module
/ProjectE
/FileD1.txt Module
/ProjectE
/FileE1.txt
203 echo "Module/ProjectE/FileE1.txt (Test 11-1)" >> $WC/Module
/ProjectE
/FileE1.txt
204 svn
mv -q Module
/ProjectE
/FileD2.txt Module
/ProjectE
/FileE2.txt
205 echo "Module/ProjectE/FileE2.txt (Test 11-1)" >> $WC/Module
/ProjectE
/FileE2.txt
206 svn_commit
"Test 11: Rename Module/ProjectD -> Module/ProjectE (part 1 of 2)" Module
/ProjectD Module
/ProjectE
/FileD1.txt Module
/ProjectE
/FileD2.txt
207 svn_commit
"Test 11: Rename Module/ProjectD -> Module/ProjectE (part 2 of 2)"
210 svn_commit
"Test 11: Rename Module/ProjectC -> Module/ProjectE"
212 # Test #12: Verify renames
213 BRANCH
="$REPOURL/branches/test12"
214 svn copy
-q -m "Create branch" $TRUNK $BRANCH
215 svn switch
-q $BRANCH
217 echo "Module/ProjectE/FileE1.txt (Test 12)" >> $WC/Module
/ProjectE
/FileE1.txt
218 echo "Module/ProjectE/FileE2.txt (Test 12)" >> $WC/Module
/ProjectE
/FileE2.txt
219 svn_commit
"Test 12: Verify Module/ProjectE/FileE*.txt"
222 svn_commit
"Test 12: Verify Module/ProjectE/FileE*.txt"
224 # Test #13: Replaces and add's inside a parent renamed folder.
225 BRANCH
="$REPOURL/branches/test13"
226 svn copy
-q -m "Create branch" $TRUNK $BRANCH
227 svn switch
-q $BRANCH
229 svn copy
-q Module
/ProjectA Module
/ProjectB
230 echo "Module/ProjectB/FileA1.txt (Test 13-1)" >> $WC/Module
/ProjectB
/FileA1.txt
231 echo "Module/ProjectB/FileA2.txt (Test 13-1)" >> $WC/Module
/ProjectB
/FileA2.txt
232 svn_commit
"Test 13: Copy Module/ProjectA -> Module/ProjectB"
233 svn
mv -q Module
/ProjectB
/FileA1.txt Module
/ProjectB
/FileB1.txt
234 echo "Module/ProjectB/FileB1.txt (Test 13-2)" >> $WC/Module
/ProjectB
/FileB1.txt
235 svn
mv -q Module
/ProjectB
/FileA2.txt Module
/ProjectB
/FileB2.txt
236 echo "Module/ProjectB/FileB2.txt (Test 13-2)" >> $WC/Module
/ProjectB
/FileB2.txt
237 svn_commit
"Test 13: Rename Module/ProjectB/FileA*.txt -> FileB*.txt"
238 svn copy
-q Module
/ProjectB
/FileB2.txt Module
/ProjectB
/FileB3.txt
239 echo "Module/ProjectB/FileB3.txt (Test 13-3)" >> $WC/Module
/ProjectB
/FileB3.txt
240 svn
rm -q Module
/ProjectB
/FileB1.txt
241 echo "Module/ProjectB/FileB1.txt (Test 13-3 - Replaced)" >> $WC/Module
/ProjectB
/FileB1.txt
242 svn add
-q Module
/ProjectB
/FileB1.txt
243 svn_commit
"Test 13: Edits to Module/ProjectB/FileB*.txt"
246 svn_commit
"Test 13: Create Module/ProjectB from Module/ProjectA"
248 # Test #14: Verify renames
249 BRANCH
="$REPOURL/branches/test14"
250 svn copy
-q -m "Create branch" $TRUNK $BRANCH
251 svn switch
-q $BRANCH
253 echo "Module/ProjectB/FileB1.txt (Test 14)" >> $WC/Module
/ProjectB
/FileB1.txt
254 echo "Module/ProjectB/FileB2.txt (Test 14)" >> $WC/Module
/ProjectB
/FileB2.txt
255 echo "Module/ProjectB/FileB3.txt (Test 14)" >> $WC/Module
/ProjectB
/FileB3.txt
256 svn_commit
"Test 14: Verify Module/ProjectB/FileB*.txt"
259 svn_commit
"Test 14: Verify Module/ProjectB/FileB*.txt"
261 # Test #15: Replace copy-from
262 BRANCH
="$REPOURL/branches/test15"
263 svn copy
-q -m "Create branch" $TRUNK $BRANCH
264 svn switch
-q $BRANCH
266 svn
rm -q Module
/ProjectB
/FileB2.txt
267 svn copy
-q -r 22 $TRUNK/Module
/ProjectC
/FileC1.txt@
22 Module
/ProjectB
/FileB2.txt
268 echo "Module/ProjectB/FileB2.txt (Test 15 - Replaced)" >> $WC/Module
/ProjectB
/FileB2.txt
269 svn_commit
"Test 15: Replace Module/ProjectB/FileB2.txt from earlier Module/ProjectC/FileC1.txt"
272 svn_commit
"Test 15: Replace Module/ProjectB/FileB2.txt from earlier Module/ProjectC/FileC1.txt"
274 # Test #16: Verify replace
275 BRANCH
="$REPOURL/branches/test16"
276 svn copy
-q -m "Create branch" $TRUNK $BRANCH
277 svn switch
-q $BRANCH
279 echo "Module/ProjectB/FileB2.txt (Test 16)" >> $WC/Module
/ProjectB
/FileB2.txt
280 svn_commit
"Test 16: Verify Module/ProjectB/FileB2.txt"
283 svn_commit
"Test 16: Verify Module/ProjectB/FileB2.txt"
285 # Test #17: Copy-from replaces and add's inside top-level initial-add folder
286 BRANCH
="$REPOURL/branches/test17"
287 svn copy
-q -m "Create branch" $TRUNK $BRANCH
288 svn switch
-q $BRANCH
291 svn copy
-q Module
/ProjectB Module
2/ProjectB
292 echo "Module2/ProjectB/FileB1.txt (Test 17-1)" >> $WC/Module
2/ProjectB
/FileB1.txt
293 echo "Module2/ProjectB/FileB2.txt (Test 17-1)" >> $WC/Module
2/ProjectB
/FileB2.txt
294 echo "Module2/ProjectB/FileB3.txt (Test 17-1)" >> $WC/Module
2/ProjectB
/FileB3.txt
295 svn_commit
"Test 17: Copy Module/ProjectB -> Module2/ProjectB"
296 svn
rm -q Module
2/ProjectB
/FileB1.txt
297 svn copy
-q -r 22 $TRUNK/Module
/ProjectC
/FileC2.txt@
22 Module
2/ProjectB
/FileB1.txt
298 echo "Module2/ProjectB/FileB1.txt (Test 17-2)" >> $WC/Module
2/ProjectB
/FileB1.txt
299 svn_commit
"Test 17: Replace Module2/ProjectB/FileB1.txt from earlier Module/ProjectC/FileC2.txt"
302 svn_commit
"Test 17: Create Module2/ProjectB from Module/ProjectB"
305 echo "Cleaning-up..."