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+)
 
  11 svnadmin create foo.svn
 
  12 svn co file://`pwd`/foo.svn foo
 
  17     svn commit -m "(r$i) $*" >/dev/null || exit 1
 
  22     echo "
\e[1m * $*
\e[0m"
 
  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"
 
  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
 
  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"
 
  75 svn merge ../branches/left --accept postpone
 
  76 git cat-file blob b5039db6:Makefile > Makefile
 
  78 i=$(commit $i "Merge left to trunk 1")
 
  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"
 
  92 svn merge -r$pre_right_update_1:$i ../branches/right
 
  93 i=$(commit $i "Cherry-pick right 2 commits to trunk")
 
  96 say "Merging RIGHT to 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")
 
 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
 
 111 i=$(commit $i "trunk update 1")
 
 113 say "Merging RIGHT to LEFT SUB-BRANCH"
 
 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")
 
 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")
 
 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"
 
 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")
 
 139 say "Merging LEFT SUB-BRANCH back to 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")
 
 147 say "Merging EVERYTHING to TRUNK"
 
 150 svn merge ../branches/left --accept postpone
 
 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")
 
 159 say "Branching b1 from trunk"
 
 161 svn cp trunk branches/b1
 
 162 i=$(commit $i "make b1 branch from trunk")
 
 164 say "Branching b2 from trunk"
 
 166 svn cp trunk branches/b2
 
 167 i=$(commit $i "make b2 branch from trunk")
 
 169 say "Make a commit to b2"
 
 174 i=$(commit $i "b2 update 1")
 
 177 say "Make a commit to b1"
 
 182 i=$(commit $i "b1 update 1")
 
 185 say "Merge b1 to trunk"
 
 188 svn merge ../branches/b1/ --accept postpone
 
 189 i=$(commit $i "Merge b1 to trunk")
 
 192 say "Make a commit to trunk before merging trunk to b2"
 
 195 echo "trunk" > trunkfile
 
 197 i=$(commit $i "trunk commit before merging trunk to b2")
 
 200 say "Merge trunk to b2"
 
 203 svn merge ../../trunk/ --accept postpone
 
 204 i=$(commit $i "Merge trunk to b2")
 
 207 say "Merge b2 to trunk"
 
 210 svn merge ../branches/b2/ --accept postpone
 
 212 svn resolved trunkfile
 
 213 i=$(commit $i "Merge b2 to trunk")
 
 216 say "Creating f1 from trunk with a new file"
 
 218 svn cp trunk branches/f1
 
 223 i=$(commit $i "make f1 branch from trunk with a new file")
 
 225 say "Creating f2 from trunk with a new file"
 
 227 svn cp trunk branches/f2
 
 232 i=$(commit $i "make f2 branch from trunk with a new file")
 
 234 say "Merge f1 and f2 to trunk in one go"
 
 237 svn merge ../branches/f1/ --accept postpone
 
 238 svn merge ../branches/f2/ --accept postpone
 
 239 i=$(commit $i "Merge f1 and f2 to trunk")
 
 242 say "Adding subdirectory to LEFT"
 
 246 echo "Yeehaw" > subdir/cowboy
 
 248 i=$(commit $i "add subdirectory to left branch")
 
 251 say "Merging LEFT to TRUNK"
 
 254 svn merge ../branches/left --accept postpone
 
 255 i=$(commit $i "merge left to trunk")
 
 258 say "Make PARTIAL branch"
 
 260 svn cp trunk/subdir branches/partial
 
 261 i=$(commit $i "make partial branch")
 
 263 say "Make a commit to PARTIAL"
 
 266 echo "racecar" > palindromes
 
 268 i=$(commit $i "partial update")
 
 271 say "Merge PARTIAL to TRUNK"
 
 274 svn merge ../../branches/partial --accept postpone
 
 275 i=$(commit $i "merge partial to trunk")
 
 280 svn cp trunk tags/v1.0
 
 281 i=$(commit $i "tagging v1.0")
 
 283 say "Branching BUGFIX from v1.0"
 
 285 svn cp tags/v1.0 branches/bugfix
 
 286 i=$(commit $i "make bugfix branch from tag")
 
 288 say "Make a commit to BUGFIX"
 
 291 echo "kayak" >> subdir/palindromes
 
 292 i=$(commit $i "commit to bugfix")
 
 295 say "Merge BUGFIX to TRUNK"
 
 298 svn merge ../branches/bugfix/ --accept postpone
 
 299 i=$(commit $i "Merge BUGFIX to TRUNK")
 
 303 svnadmin dump foo.svn > svn-mergeinfo.dump