#!/bin/sh # #---mergeFork. Merging-assist tool for a fork between svn branches. # See no-argument usage output for more information. # # Also see my blog entry at http://thedance.net/~roth/TECHBLOG/mergeFork.html # # Assumes the following programs and scripts are in the user's path: # mergeFork2 # merge2 # # mergeFork is distributed as an "open source" tool under the terms # of the MIT artistic license (see www.opensource.org for details). # Basically, you can use or distribute this code for any purpose, free of # charge, so long as you retain all of this notice. This is an "as-is" # tool; no warranties, implicit or explicit, are provided. The author is # not liable for any damages or effects resulting from the use of # this tool. # # 04/14/2008 Charles Roth. #----------------------------------------------------------- if test "x$6" = "x"; then echo "Usage: mergeFork revBase branchDirA revA branchDirB revB filename" echo " " echo "For example: " echo " Checked-out trunk in directory 'trunk'." echo " Checked-out branch alpha in directory 'alpha'." echo " Trying to merge a fork in a file stuff.java." echo " Alpha branched at rev 100, now at rev 120." echo " Trunk is at rev 130." echo " " echo "mergeFork 100 alpha 120 trunk 130 stuff.java" echo " produces merged file 'm', each line has 2 leading chars:" echo " A0 means original (rev 100) line from alpha" echo " A1 means changed line in alpha." echo " B0,B1 similarly for trunk." echo " A means unchanged line in alpha that is not in trunk" echo " B similarly for trunk" echo " 0 means original in both alpha and trunk" echo " " exit fi if test ! -d $2; then echo "$2 is not a directory" exit fi if test ! -d $4; then echo "$2 is not a directory" exit fi revBase=$1 dirA=$2 revA=$3 dirB=$4 revB=$5 file=$6 mergeFork2 $dirA $file $revBase $revA cat m | sed "s/^2/0/" >m.a mergeFork2 $dirB $file $revBase $revB cat m | sed "s/^2/0/" >m.b merge2 m.a m.b m 2000 cat m | sed "s/^1/A/" | sed "s/^2/B/" >m.m mv m.m m vi m