t / t9151 / make-svnmerge-dumpon commit git-svn: expand the svn mergeinfo test suite, highlighting some failures (1d144aa)
   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
   7rm -rf foo.svn foo
   8set -e
   9
  10mkdir foo.svn
  11svnadmin create foo.svn
  12svn co file://`pwd`/foo.svn foo
  13
  14commit() {
  15    i=$(( $1 + 1 ))
  16    shift;
  17    svn commit -m "(r$i) $*" >/dev/null || exit 1
  18    echo $i
  19}
  20
  21say() {
  22    echo "\e[1m * $*\e[0m"
  23}
  24
  25i=0
  26cd foo
  27mkdir trunk
  28mkdir branches
  29svn add trunk branches
  30i=$(commit $i "Setup trunk and branches")
  31
  32git cat-file blob 6683463e:Makefile > trunk/Makefile
  33svn add trunk/Makefile 
  34
  35say "Committing ANCESTOR"
  36i=$(commit $i "ancestor")
  37svn cp trunk branches/left
  38
  39say "Committing BRANCH POINT"
  40i=$(commit $i "make left branch")
  41svn cp trunk branches/right
  42
  43say "Committing other BRANCH POINT"
  44i=$(commit $i "make right branch")
  45
  46say "Committing LEFT UPDATE"
  47git cat-file blob 5873b67e:Makefile > branches/left/Makefile
  48i=$(commit $i "left update 1")
  49
  50git cat-file blob 75118b13:Makefile > branches/right/Makefile
  51say "Committing RIGHT UPDATE"
  52pre_right_update_1=$i
  53i=$(commit $i "right update 1")
  54
  55say "Making more commits on LEFT"
  56git cat-file blob ff5ebe39:Makefile > branches/left/Makefile
  57i=$(commit $i "left update 2")
  58git cat-file blob b5039db6:Makefile > branches/left/Makefile
  59i=$(commit $i "left update 3")
  60
  61say "Making a LEFT SUB-BRANCH"
  62svn cp branches/left branches/left-sub
  63sub_left_make=$i
  64i=$(commit $i "make left sub-branch")
  65
  66say "Making a commit on LEFT SUB-BRANCH"
  67echo "crunch" > branches/left-sub/README
  68svn add branches/left-sub/README
  69i=$(commit $i "left sub-branch update 1")
  70
  71say "Merging LEFT to TRUNK"
  72svn update
  73cd trunk
  74svn merge ../branches/left --accept postpone
  75git cat-file blob b5039db6:Makefile > Makefile
  76svn resolved Makefile
  77i=$(commit $i "Merge left to trunk 1")
  78cd ..
  79
  80say "Making more commits on LEFT and RIGHT"
  81echo "touche" > branches/left/zlonk
  82svn add branches/left/zlonk
  83i=$(commit $i "left update 4")
  84echo "thwacke" > branches/right/bang
  85svn add branches/right/bang
  86i=$(commit $i "right update 2")
  87
  88say "Squash merge of RIGHT tip 2 commits onto TRUNK"
  89svn update
  90cd trunk
  91svn merge -r$pre_right_update_1:$i ../branches/right
  92i=$(commit $i "Cherry-pick right 2 commits to trunk")
  93cd ..
  94
  95say "Merging RIGHT to TRUNK"
  96svn update
  97cd trunk
  98svn merge ../branches/right --accept postpone
  99git cat-file blob b51ad431:Makefile > Makefile
 100svn resolved Makefile
 101i=$(commit $i "Merge right to trunk 1")
 102cd ..
 103
 104say "Making more commits on RIGHT and TRUNK"
 105echo "whamm" > branches/right/urkkk
 106svn add branches/right/urkkk
 107i=$(commit $i "right update 3")
 108echo "pow" > trunk/vronk
 109svn add trunk/vronk
 110i=$(commit $i "trunk update 1")
 111
 112say "Merging RIGHT to LEFT SUB-BRANCH"
 113svn update
 114cd branches/left-sub
 115svn merge ../right --accept postpone
 116git cat-file blob b51ad431:Makefile > Makefile
 117svn resolved Makefile
 118i=$(commit $i "Merge right to left sub-branch")
 119cd ../..
 120
 121say "Making more commits on LEFT SUB-BRANCH and LEFT"
 122echo "zowie" > branches/left-sub/wham_eth
 123svn add branches/left-sub/wham_eth
 124pre_sub_left_update_2=$i
 125i=$(commit $i "left sub-branch update 2")
 126sub_left_update_2=$i
 127echo "eee_yow" > branches/left/glurpp
 128svn add branches/left/glurpp
 129i=$(commit $i "left update 5")
 130
 131say "Cherry pick LEFT SUB-BRANCH commit to LEFT"
 132svn update
 133cd branches/left
 134svn merge -r$pre_sub_left_update_2:$sub_left_update_2 ../left-sub
 135i=$(commit $i "Cherry-pick left sub-branch commit to left")
 136cd ../..
 137
 138say "Merging LEFT SUB-BRANCH back to LEFT"
 139svn update
 140cd branches/left
 141# it's only a merge because the previous merge cherry-picked the top commit
 142svn merge -r$sub_left_make:$sub_left_update_2 ../left-sub --accept postpone
 143i=$(commit $i "Merge left sub-branch to left")
 144cd ../..
 145
 146say "Merging EVERYTHING to TRUNK"
 147svn update
 148cd trunk
 149svn merge ../branches/left --accept postpone
 150svn resolved bang
 151i=$(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.
 154svn merge ../branches/right --accept postpone
 155i=$(commit $i "non-merge right to trunk 2")
 156cd ..
 157
 158cd ..
 159svnadmin dump foo.svn > svn-mergeinfo.dump
 160
 161rm -rf foo foo.svn