]> rtime.felk.cvut.cz Git - git.git/blob - t/t9151/make-svnmerge-dump
Documentation/config: describe status.submodulesummary
[git.git] / t / t9151 / make-svnmerge-dump
1 #!/bin/sh
2 #
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+)
5 #
6
7 rm -rf foo.svn foo
8 set -e
9
10 mkdir foo.svn
11 svnadmin create foo.svn
12 svn co file://`pwd`/foo.svn foo
13
14 commit() {
15     i=$(( $1 + 1 ))
16     shift;
17     svn commit -m "(r$i) $*" >/dev/null || exit 1
18     echo $i
19 }
20
21 say() {
22     echo "\e[1m * $*\e[0m"
23 }
24
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")
32
33 git cat-file blob 6683463e:Makefile > trunk/Makefile
34 svn add trunk/Makefile 
35
36 say "Committing ANCESTOR"
37 i=$(commit $i "ancestor")
38 svn cp trunk branches/left
39
40 say "Committing BRANCH POINT"
41 i=$(commit $i "make left branch")
42 svn cp trunk branches/right
43
44 say "Committing other BRANCH POINT"
45 i=$(commit $i "make right branch")
46
47 say "Committing LEFT UPDATE"
48 git cat-file blob 5873b67e:Makefile > branches/left/Makefile
49 i=$(commit $i "left update 1")
50
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")
55
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")
61
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")
66
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")
71
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 ..
80
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")
88
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 ..
95
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 ..
104
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")
112
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 ../..
121
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")
131
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 ../..
138
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 ../..
146
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 ..
158
159 say "Adding subdirectory to LEFT"
160 svn update
161 cd branches/left
162 mkdir subdir
163 echo "Yeehaw" > subdir/cowboy
164 svn add subdir
165 i=$(commit $i "add subdirectory to left branch")
166 cd ../../
167
168 say "Merging LEFT to TRUNK"
169 svn update
170 cd trunk
171 svn merge ../branches/left --accept postpone
172 i=$(commit $i "merge left to trunk")
173 cd ..
174
175 say "Make PARTIAL branch"
176 svn update
177 i=$(commit $i "make partial branch")
178 svn cp trunk/subdir branches/partial
179
180 say "Make a commit to PARTIAL"
181 svn update
182 cd branches/partial
183 echo "racecar" > palindromes
184 svn add palindromes
185 i=$(commit $i "partial update")
186 cd ../../
187
188 say "Merge PARTIAL to TRUNK"
189 svn update
190 cd trunk/subdir
191 svn merge ../../branches/partial --accept postpone
192 i=$(commit $i "merge partial to trunk")
193 cd ../../
194
195 say "Tagging trunk"
196 svn update
197 i=$(commit $i "tagging v1.0")
198 svn cp trunk tags/v1.0
199
200 say "Branching BUGFIX from v1.0"
201 svn update
202 i=$(commit $i "make bugfix branch from tag")
203 svn cp tags/v1.0 branches/bugfix
204
205 say "Make a commit to BUGFIX"
206 svn update
207 cd branches/bugfix/
208 echo "kayak" >> subdir/palindromes
209 i=$(commit $i "commit to bugfix")
210 cd ../../
211
212 say "Merge BUGFIX to TRUNK"
213 svn update
214 cd trunk
215 svn merge ../branches/bugfix/ --accept postpone
216 i=$(commit $i "Merge BUGFIX to TRUNK")
217 cd ..
218
219 cd ..
220 svnadmin dump foo.svn > svn-mergeinfo.dump
221
222 rm -rf foo foo.svn