#!/bin/sh
#
#---mergeFork2   Subscript for mergeFork.
#
#   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.
#----------------------------------------------------------------

branchDir=$1
filename=$2
oldRev=$3
newRev=$4
cwd=`pwd`

cd $branchDir
thisRev=`svn info | grep "^Revision:" | (read a b c; echo $b)`
svn update $filename -r $oldRev
cp $filename $filename.$oldRev
if test "x$newRev" = "x"; then
   svn update $filename
   new=new
   cp $filename $filename.$new
else
   svn update $filename -r $newRev
   new=$newRev
   cp $filename $filename.$new
fi
svn update $filename -r $thisRev

cd $cwd
rm -f m
merge2 $branchDir/$filename.$new $branchDir/$filename.$oldRev m 2000
rm -f  $branchDir/$filename.$new $branchDir/$filename.$oldRev