#!/bin/bash
pushd $MSSCFHOME
for adir in *-2-10
do
	if [ -d $adir/java ]; then
		pushd $adir/java
			if [ ! -d bin ]; then
				if [ -f bin ]; then
					rm -f bin
				fi
				mkdir bin
			fi
			pushd bin
				$GIT rm -f net-sourceforge-MSSCodeFactory-CFCore-2-9-$1.jar
				cp $MSSCFHOME/net-sourceforge-MSSCodeFactory-CFCore-2-9/java/lib/net-sourceforge-MSSCodeFactory-CFCore-2.9.$2.jar .
				$GIT add .
			popd
			if [ -f marktemp ] ; then
				rm marktemp
			fi
			echo "1,\$s/$1/$2/g" > marktemp
			echo "w" >> marktemp
			echo "q" >> marktemp
			echo "quit" >> marktemp
			for afile in `grep -l $1 build.xml bin/CF*210*`
			do
				echo "Processing $adir/java/$afile..."
				$EX $afile < marktemp
			done
			$GIT add build.xml
			pushd bin
				$GIT add .
			popd
			rm marktemp
			$GIT commit -m "Switched from CFCore 2.9.$1 to CFCore 2.9.$2"
			$GIT push
		popd
	fi
done
popd
