#!/bin/sh

ROOT_DIR=$(cd ../../..;pwd)
ALL_COMPOS=`cat $ROOT_DIR/amit_priv/CWebUI.90.mk/mk.uicompo|awk -F'[ /]' '{print $1}'`
ui_info=$ROOT_DIR/src/amit_priv/CWebUI/ui_info.txt

if [ -e $ui_info ]; then
	rm $ui_info
fi

k=1
echo "Creating ui_info.txt in CWebUI. Please wait..."

for ui in $ALL_COMPOS; do
	
	path_num=`cat $ROOT_DIR/amit_priv/CWebUI.90.mk/mk.uicompo |awk -F'[ /]' 'NR=='$k'{print $3}' |awk -F'-' '{print NF}'`
	if [ "$path_num" == 1 ]; then
		cd $ui;
	else
		cd $ui"_func";
	fi;
	
	new_rev=`svn info | grep Rev: | awk '{print$4}'`
	svn_trunk=`svn info | grep URL: | awk -F'[/ ]' '{print$7}'`
	svn_path=`svn info | grep URL: | awk '{print$2}'`

	echo "Component Name:$ui  Directory:$svn_trunk  Rev:$new_rev  URL:$svn_path" >> $ui_info
	echo "$svn_path -r $new_rev  " >> $ROOT_DIR/../image/svn.list 
	cd ..;
	k=$k+1
done;

echo "Finished!"
