archive: handle commits with an empty tree
[git/jnareb-git.git] / t / t9151 / make-svnmerge-dump
blobe1e138cb1a73cfa312cf4d375d77da90418cc7b5
1 #!/bin/sh
3 # this script sets up a Subversion repository for Makefile in the
4 # first ever git merge, as if it were done with svnmerge (SVN 1.5+)
7 rm -rf foo.svn foo
8 set -e
10 mkdir foo.svn
11 svnadmin create foo.svn
12 svn co file://`pwd`/foo.svn foo
14 commit() {
15 i=$(( $1 + 1 ))
16 shift;
17 svn commit -m "(r$i) $*" >/dev/null || exit 1
18 echo $i
21 say() {
22 echo "\e[1m * $*\e[0m"
25 i=0
26 cd foo
27 mkdir trunk
28 mkdir branches
29 mkdir tags
30 svn add trunk branches tags
31 i=$(commit $i "Setup trunk, branches, and tags")
33 git cat-file blob 6683463e:Makefile > trunk/Makefile
34 svn add trunk/Makefile
36 say "Committing ANCESTOR"
37 i=$(commit $i "ancestor")
38 svn cp trunk branches/left
40 say "Committing BRANCH POINT"
41 i=$(commit $i "make left branch")
42 svn cp trunk branches/right
44 say "Committing other BRANCH POINT"
45 i=$(commit $i "make right branch")
47 say "Committing LEFT UPDATE"
48 git cat-file blob 5873b67e:Makefile > branches/left/Makefile
49 i=$(commit $i "left update 1")
51 git cat-file blob 75118b13:Makefile > branches/right/Makefile
52 say "Committing RIGHT UPDATE"
53 pre_right_update_1=$i
54 i=$(commit $i "right update 1")
56 say "Making more commits on LEFT"
57 git cat-file blob ff5ebe39:Makefile > branches/left/Makefile
58 i=$(commit $i "left update 2")
59 git cat-file blob b5039db6:Makefile > branches/left/Makefile
60 i=$(commit $i "left update 3")
62 say "Making a LEFT SUB-BRANCH"
63 svn cp branches/left branches/left-sub
64 sub_left_make=$i
65 i=$(commit $i "make left sub-branch")
67 say "Making a commit on LEFT SUB-BRANCH"
68 echo "crunch" > branches/left-sub/README
69 svn add branches/left-sub/README
70 i=$(commit $i "left sub-branch update 1")
72 say "Merging LEFT to TRUNK"
73 svn update
74 cd trunk
75 svn merge ../branches/left --accept postpone
76 git cat-file blob b5039db6:Makefile > Makefile
77 svn resolved Makefile
78 i=$(commit $i "Merge left to trunk 1")
79 cd ..
81 say "Making more commits on LEFT and RIGHT"
82 echo "touche" > branches/left/zlonk
83 svn add branches/left/zlonk
84 i=$(commit $i "left update 4")
85 echo "thwacke" > branches/right/bang
86 svn add branches/right/bang
87 i=$(commit $i "right update 2")
89 say "Squash merge of RIGHT tip 2 commits onto TRUNK"
90 svn update
91 cd trunk
92 svn merge -r$pre_right_update_1:$i ../branches/right
93 i=$(commit $i "Cherry-pick right 2 commits to trunk")
94 cd ..
96 say "Merging RIGHT to TRUNK"
97 svn update
98 cd trunk
99 svn merge ../branches/right --accept postpone
100 git cat-file blob b51ad431:Makefile > Makefile
101 svn resolved Makefile
102 i=$(commit $i "Merge right to trunk 1")
103 cd ..
105 say "Making more commits on RIGHT and TRUNK"
106 echo "whamm" > branches/right/urkkk
107 svn add branches/right/urkkk
108 i=$(commit $i "right update 3")
109 echo "pow" > trunk/vronk
110 svn add trunk/vronk
111 i=$(commit $i "trunk update 1")
113 say "Merging RIGHT to LEFT SUB-BRANCH"
114 svn update
115 cd branches/left-sub
116 svn merge ../right --accept postpone
117 git cat-file blob b51ad431:Makefile > Makefile
118 svn resolved Makefile
119 i=$(commit $i "Merge right to left sub-branch")
120 cd ../..
122 say "Making more commits on LEFT SUB-BRANCH and LEFT"
123 echo "zowie" > branches/left-sub/wham_eth
124 svn add branches/left-sub/wham_eth
125 pre_sub_left_update_2=$i
126 i=$(commit $i "left sub-branch update 2")
127 sub_left_update_2=$i
128 echo "eee_yow" > branches/left/glurpp
129 svn add branches/left/glurpp
130 i=$(commit $i "left update 5")
132 say "Cherry pick LEFT SUB-BRANCH commit to LEFT"
133 svn update
134 cd branches/left
135 svn merge -r$pre_sub_left_update_2:$sub_left_update_2 ../left-sub
136 i=$(commit $i "Cherry-pick left sub-branch commit to left")
137 cd ../..
139 say "Merging LEFT SUB-BRANCH back to LEFT"
140 svn update
141 cd branches/left
142 # it's only a merge because the previous merge cherry-picked the top commit
143 svn merge -r$sub_left_make:$sub_left_update_2 ../left-sub --accept postpone
144 i=$(commit $i "Merge left sub-branch to left")
145 cd ../..
147 say "Merging EVERYTHING to TRUNK"
148 svn update
149 cd trunk
150 svn merge ../branches/left --accept postpone
151 svn resolved bang
152 i=$(commit $i "Merge left to trunk 2")
153 # this merge, svn happily updates the mergeinfo, but there is actually
154 # nothing to merge. git-svn will not make a meaningless merge commit.
155 svn merge ../branches/right --accept postpone
156 i=$(commit $i "non-merge right to trunk 2")
157 cd ..
159 say "Branching b1 from trunk"
160 svn update
161 svn cp trunk branches/b1
162 i=$(commit $i "make b1 branch from trunk")
164 say "Branching b2 from trunk"
165 svn update
166 svn cp trunk branches/b2
167 i=$(commit $i "make b2 branch from trunk")
169 say "Make a commit to b2"
170 svn update
171 cd branches/b2
172 echo "b2" > b2file
173 svn add b2file
174 i=$(commit $i "b2 update 1")
175 cd ../..
177 say "Make a commit to b1"
178 svn update
179 cd branches/b1
180 echo "b1" > b1file
181 svn add b1file
182 i=$(commit $i "b1 update 1")
183 cd ../..
185 say "Merge b1 to trunk"
186 svn update
187 cd trunk
188 svn merge ../branches/b1/ --accept postpone
189 i=$(commit $i "Merge b1 to trunk")
190 cd ..
192 say "Make a commit to trunk before merging trunk to b2"
193 svn update
194 cd trunk
195 echo "trunk" > trunkfile
196 svn add trunkfile
197 i=$(commit $i "trunk commit before merging trunk to b2")
198 cd ..
200 say "Merge trunk to b2"
201 svn update
202 cd branches/b2
203 svn merge ../../trunk/ --accept postpone
204 i=$(commit $i "Merge trunk to b2")
205 cd ../..
207 say "Merge b2 to trunk"
208 svn update
209 cd trunk
210 svn merge ../branches/b2/ --accept postpone
211 svn resolved b1file
212 svn resolved trunkfile
213 i=$(commit $i "Merge b2 to trunk")
214 cd ..
216 say "Creating f1 from trunk with a new file"
217 svn update
218 svn cp trunk branches/f1
219 cd branches/f1
220 echo "f1" > f1file
221 svn add f1file
222 cd ../..
223 i=$(commit $i "make f1 branch from trunk with a new file")
225 say "Creating f2 from trunk with a new file"
226 svn update
227 svn cp trunk branches/f2
228 cd branches/f2
229 echo "f2" > f2file
230 svn add f2file
231 cd ../..
232 i=$(commit $i "make f2 branch from trunk with a new file")
234 say "Merge f1 and f2 to trunk in one go"
235 svn update
236 cd trunk
237 svn merge ../branches/f1/ --accept postpone
238 svn merge ../branches/f2/ --accept postpone
239 i=$(commit $i "Merge f1 and f2 to trunk")
240 cd ..
242 say "Adding subdirectory to LEFT"
243 svn update
244 cd branches/left
245 mkdir subdir
246 echo "Yeehaw" > subdir/cowboy
247 svn add subdir
248 i=$(commit $i "add subdirectory to left branch")
249 cd ../../
251 say "Merging LEFT to TRUNK"
252 svn update
253 cd trunk
254 svn merge ../branches/left --accept postpone
255 i=$(commit $i "merge left to trunk")
256 cd ..
258 say "Make PARTIAL branch"
259 svn update
260 svn cp trunk/subdir branches/partial
261 i=$(commit $i "make partial branch")
263 say "Make a commit to PARTIAL"
264 svn update
265 cd branches/partial
266 echo "racecar" > palindromes
267 svn add palindromes
268 i=$(commit $i "partial update")
269 cd ../../
271 say "Merge PARTIAL to TRUNK"
272 svn update
273 cd trunk/subdir
274 svn merge ../../branches/partial --accept postpone
275 i=$(commit $i "merge partial to trunk")
276 cd ../../
278 say "Tagging trunk"
279 svn update
280 svn cp trunk tags/v1.0
281 i=$(commit $i "tagging v1.0")
283 say "Branching BUGFIX from v1.0"
284 svn update
285 svn cp tags/v1.0 branches/bugfix
286 i=$(commit $i "make bugfix branch from tag")
288 say "Make a commit to BUGFIX"
289 svn update
290 cd branches/bugfix/
291 echo "kayak" >> subdir/palindromes
292 i=$(commit $i "commit to bugfix")
293 cd ../../
295 say "Merge BUGFIX to TRUNK"
296 svn update
297 cd trunk
298 svn merge ../branches/bugfix/ --accept postpone
299 i=$(commit $i "Merge BUGFIX to TRUNK")
300 cd ..
302 cd ..
303 svnadmin dump foo.svn > svn-mergeinfo.dump
305 rm -rf foo foo.svn