]>
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_commit
"Test 1: Add Module/ProjectB"
62 # Test #2: Rename files
63 # * Test rename support
64 # * Test committing rename in two different branch commits: first deletion, then add
65 BRANCH
="$REPOURL/branches/test2"
66 svn copy
-q -m "Create branch" $TRUNK $BRANCH
69 svn
mv -q Module
/ProjectA
/FileA2.txt Module
/ProjectB
/FileB2.txt
70 echo "Module/ProjectB/FileB2.txt (Test 2)" > $WC/Module
/ProjectB
/FileB2.txt
71 svn_commit
"Test 2: Rename Module/ProjectA/FileA2.txt -> Module/ProjectB/FileB2.txt (part 1 of 2)" Module
/ProjectA
72 svn_commit
"Test 2: Rename Module/ProjectA/FileA2.txt -> Module/ProjectB/FileB2.txt (part 2 of 2)" Module
/ProjectB
75 svn_commit
"Test 2: Rename Module/ProjectA/FileA2.txt -> Module/ProjectB/FileB3.txt"
77 # Test #3: Verify rename
78 BRANCH
="$REPOURL/branches/test3"
79 svn copy
-q -m "Create branch" $TRUNK $BRANCH
82 echo "Module/ProjectB/FileB2.txt (Test 3)" >> $WC/Module
/ProjectB
/FileB2.txt
83 svn_commit
"Test 3: Verify Module/ProjectB/FileB2.txt"
86 svn_commit
"Test 3: Verify Module/ProjectB/FileB2.txt"
88 # Test #4: Replace files
89 # * Test replace support
90 BRANCH
="$REPOURL/branches/test4"
91 svn copy
-q -m "Create branch" $TRUNK $BRANCH
94 svn
rm -q Module
/ProjectA
/FileA1.txt
95 echo "Module/ProjectA/FileA1.txt (Test 4 - Replaced)" > $WC/Module
/ProjectA
/FileA1.txt
96 svn add
-q Module
/ProjectA
/FileA1.txt
97 svn_commit
"Test 4: Replace Module/ProjectA/FileA1.txt"
100 svn_commit
"Test 4: Replace Module/ProjectA/FileA1.txt"
102 # Test #5: Rename files + folders
103 # * Test rename support
104 # * Create complex find-ancestors case, where files are renamed within a renamed folder on a branch
105 BRANCH
="$REPOURL/branches/test5"
106 svn copy
-q -m "Create branch" $TRUNK $BRANCH
107 svn switch
-q $BRANCH
109 svn
mv -q Module
/ProjectB Module
/ProjectC
110 svn
mv -q Module
/ProjectC
/FileB1.txt Module
/ProjectC
/FileC1.txt
111 echo "Module/ProjectC/FileC1.txt (Test 5)" >> $WC/Module
/ProjectC
/FileC1.txt
112 svn
mv -q Module
/ProjectC
/FileB2.txt Module
/ProjectC
/FileC2.txt
113 echo "Module/ProjectC/FileC2.txt (Test 5)" >> $WC/Module
/ProjectC
/FileC2.txt
114 svn_commit
"Test 5: Rename Module/ProjectB -> Module/ProjectC"
117 svn_commit
"Test 5: Rename Module/ProjectB -> Module/ProjectC"
119 # Test #6: Verify rename
120 BRANCH
="$REPOURL/branches/test6"
121 svn copy
-q -m "Create branch" $TRUNK $BRANCH
122 svn switch
-q $BRANCH
124 echo "Module/ProjectC/FileC1.txt (Test 6)" >> $WC/Module
/ProjectC
/FileC1.txt
125 echo "Module/ProjectC/FileC2.txt (Test 6)" >> $WC/Module
/ProjectC
/FileC2.txt
126 svn_commit
"Test 6: Verify Module/ProjectC/FileC*.txt"
129 svn_commit
"Test 6: Verify Module/ProjectC/FileC*.txt"
131 # Test #7: Rename files
132 # * Test rename support
133 # * Rename multiple files in the same folder
134 BRANCH
="$REPOURL/branches/test7"
135 svn copy
-q -m "Create branch" $TRUNK $BRANCH
136 svn switch
-q $BRANCH
138 svn
mv -q Module
/ProjectC
/FileC1.txt Module
/ProjectC
/FileC3.txt
139 echo "Module/ProjectC/FileC3.txt (Test 7)" >> $WC/Module
/ProjectC
/FileC3.txt
140 svn
mv -q Module
/ProjectC
/FileC2.txt Module
/ProjectC
/FileC4.txt
141 echo "Module/ProjectC/FileC4.txt (Test 7)" >> $WC/Module
/ProjectC
/FileC4.txt
142 svn_commit
"Test 7: Rename Module/ProjectC/FileC*.txt"
145 svn_commit
"Test 7: Rename Module/ProjectC/FileC*.txt"
147 # Test #8: Verify rename
148 BRANCH
="$REPOURL/branches/test8"
149 svn copy
-q -m "Create branch" $TRUNK $BRANCH
150 svn switch
-q $BRANCH
152 echo "Module/ProjectC/FileC3.txt (Test 8)" >> $WC/Module
/ProjectC
/FileC3.txt
153 echo "Module/ProjectC/FileC4.txt (Test 8)" >> $WC/Module
/ProjectC
/FileC4.txt
154 svn_commit
"Test 8: Verify Module/ProjectC/FileC*.txt"
157 svn_commit
"Test 8: Verify Module/ProjectC/FileC*.txt"
159 # Test #9: Copy from older revision
160 svn copy
-q -r 8 $TRUNK/Module
/ProjectA
/FileA2.txt@
8 $WC/Module
/ProjectA
/FileA2.txt
161 svn propdel
-q svn
:mergeinfo Module
/ProjectA
/FileA2.txt
162 svn_commit
"Test 9: Restore Module/ProjectA/FileA2.txt"
164 # Test #10: Verify copy
165 BRANCH
="$REPOURL/branches/test10"
166 svn copy
-q -m "Create branch" $TRUNK $BRANCH
167 svn switch
-q $BRANCH
169 echo "Module/ProjectA/FileA2.txt (Test 10)" >> $WC/Module
/ProjectA
/FileA2.txt
170 svn_commit
"Test 10: Verify Module/ProjectA/FileA2.txt"
173 svn_commit
"Test 10: Verify Module/ProjectA/FileA2.txt"
175 # Test #11: Rename files + folders, multiple chained renames
176 # * Test rename support
177 # * Create complicated find-ancestors case, where files/folders are renamed multiple times on branch
178 BRANCH
="$REPOURL/branches/test11"
179 svn copy
-q -m "Create branch" $TRUNK $BRANCH
180 svn switch
-q $BRANCH
182 svn
mv -q Module
/ProjectC Module
/ProjectD
183 svn
mv -q Module
/ProjectD
/FileC3.txt Module
/ProjectD
/FileD1.txt
184 echo "Module/ProjectD/FileD1.txt (Test 11)" >> $WC/Module
/ProjectD
/FileD1.txt
185 svn
mv -q Module
/ProjectD
/FileC4.txt Module
/ProjectD
/FileD2.txt
186 echo "Module/ProjectD/FileD2.txt (Test 11)" >> $WC/Module
/ProjectD
/FileD2.txt
187 svn_commit
"Test 11: Rename Module/ProjectC -> Module/ProjectD (part 1 of 2)" Module
/ProjectC Module
/ProjectD
/FileC3.txt Module
/ProjectD
/FileC4.txt
188 svn_commit
"Test 11: Rename Module/ProjectC -> Module/ProjectD (part 2 of 2)"
189 BRANCH
="$REPOURL/branches/test11-1"
190 svn copy
-q -m "Create branch" $TRUNK $BRANCH
191 svn switch
-q $BRANCH
193 svn merge
-q $REPOURL/branches
/test11
194 svn_commit
"Test 11: Re-branch"
195 svn
mv -q Module
/ProjectD Module
/ProjectE
196 svn
mv -q Module
/ProjectE
/FileD1.txt Module
/ProjectE
/FileE1.txt
197 echo "Module/ProjectE/FileE1.txt (Test 11-1)" >> $WC/Module
/ProjectE
/FileE1.txt
198 svn
mv -q Module
/ProjectE
/FileD2.txt Module
/ProjectE
/FileE2.txt
199 echo "Module/ProjectE/FileE2.txt (Test 11-1)" >> $WC/Module
/ProjectE
/FileE2.txt
200 svn_commit
"Test 11: Rename Module/ProjectD -> Module/ProjectE (part 1 of 2)" Module
/ProjectD Module
/ProjectE
/FileD1.txt Module
/ProjectE
/FileD2.txt
201 svn_commit
"Test 11: Rename Module/ProjectD -> Module/ProjectE (part 2 of 2)"
204 svn_commit
"Test 11: Rename Module/ProjectC -> Module/ProjectE"
207 echo "Cleaning-up..."