Git 1.6.6.1
[git/mingw/4msysgit/kblees.git] / t / t9151 / make-svnmerge-dump
blobd917717cf3f177be7ed68306d078ac3362744bc8
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 svn add trunk branches
30 i=$(commit $i "Setup trunk and branches")
32 git cat-file blob 6683463e:Makefile > trunk/Makefile
33 svn add trunk/Makefile
35 say "Committing ANCESTOR"
36 i=$(commit $i "ancestor")
37 svn cp trunk branches/left
39 say "Committing BRANCH POINT"
40 i=$(commit $i "make left branch")
41 svn cp trunk branches/right
43 say "Committing other BRANCH POINT"
44 i=$(commit $i "make right branch")
46 say "Committing LEFT UPDATE"
47 git cat-file blob 5873b67e:Makefile > branches/left/Makefile
48 i=$(commit $i "left update 1")
50 git cat-file blob 75118b13:Makefile > branches/right/Makefile
51 say "Committing RIGHT UPDATE"
52 pre_right_update_1=$i
53 i=$(commit $i "right update 1")
55 say "Making more commits on LEFT"
56 git cat-file blob ff5ebe39:Makefile > branches/left/Makefile
57 i=$(commit $i "left update 2")
58 git cat-file blob b5039db6:Makefile > branches/left/Makefile
59 i=$(commit $i "left update 3")
61 say "Making a LEFT SUB-BRANCH"
62 svn cp branches/left branches/left-sub
63 sub_left_make=$i
64 i=$(commit $i "make left sub-branch")
66 say "Making a commit on LEFT SUB-BRANCH"
67 echo "crunch" > branches/left-sub/README
68 svn add branches/left-sub/README
69 i=$(commit $i "left sub-branch update 1")
71 say "Merging LEFT to TRUNK"
72 svn update
73 cd trunk
74 svn merge ../branches/left --accept postpone
75 git cat-file blob b5039db6:Makefile > Makefile
76 svn resolved Makefile
77 i=$(commit $i "Merge left to trunk 1")
78 cd ..
80 say "Making more commits on LEFT and RIGHT"
81 echo "touche" > branches/left/zlonk
82 svn add branches/left/zlonk
83 i=$(commit $i "left update 4")
84 echo "thwacke" > branches/right/bang
85 svn add branches/right/bang
86 i=$(commit $i "right update 2")
88 say "Squash merge of RIGHT tip 2 commits onto TRUNK"
89 svn update
90 cd trunk
91 svn merge -r$pre_right_update_1:$i ../branches/right
92 i=$(commit $i "Cherry-pick right 2 commits to trunk")
93 cd ..
95 say "Merging RIGHT to TRUNK"
96 svn update
97 cd trunk
98 svn merge ../branches/right --accept postpone
99 git cat-file blob b51ad431:Makefile > Makefile
100 svn resolved Makefile
101 i=$(commit $i "Merge right to trunk 1")
102 cd ..
104 say "Making more commits on RIGHT and TRUNK"
105 echo "whamm" > branches/right/urkkk
106 svn add branches/right/urkkk
107 i=$(commit $i "right update 3")
108 echo "pow" > trunk/vronk
109 svn add trunk/vronk
110 i=$(commit $i "trunk update 1")
112 say "Merging RIGHT to LEFT SUB-BRANCH"
113 svn update
114 cd branches/left-sub
115 svn merge ../right --accept postpone
116 git cat-file blob b51ad431:Makefile > Makefile
117 svn resolved Makefile
118 i=$(commit $i "Merge right to left sub-branch")
119 cd ../..
121 say "Making more commits on LEFT SUB-BRANCH and LEFT"
122 echo "zowie" > branches/left-sub/wham_eth
123 svn add branches/left-sub/wham_eth
124 pre_sub_left_update_2=$i
125 i=$(commit $i "left sub-branch update 2")
126 sub_left_update_2=$i
127 echo "eee_yow" > branches/left/glurpp
128 svn add branches/left/glurpp
129 i=$(commit $i "left update 5")
131 say "Cherry pick LEFT SUB-BRANCH commit to LEFT"
132 svn update
133 cd branches/left
134 svn merge -r$pre_sub_left_update_2:$sub_left_update_2 ../left-sub
135 i=$(commit $i "Cherry-pick left sub-branch commit to left")
136 cd ../..
138 say "Merging LEFT SUB-BRANCH back to LEFT"
139 svn update
140 cd branches/left
141 # it's only a merge because the previous merge cherry-picked the top commit
142 svn merge -r$sub_left_make:$sub_left_update_2 ../left-sub --accept postpone
143 i=$(commit $i "Merge left sub-branch to left")
144 cd ../..
146 say "Merging EVERYTHING to TRUNK"
147 svn update
148 cd trunk
149 svn merge ../branches/left --accept postpone
150 svn resolved bang
151 i=$(commit $i "Merge left to trunk 2")
152 # this merge, svn happily updates the mergeinfo, but there is actually
153 # nothing to merge. git-svn will not make a meaningless merge commit.
154 svn merge ../branches/right --accept postpone
155 i=$(commit $i "non-merge right to trunk 2")
156 cd ..
158 cd ..
159 svnadmin dump foo.svn > svn-mergeinfo.dump
161 rm -rf foo foo.svn