Code:
Dear friends this script is useful for SVN
Code:
#!/bin/bash
####################################################################################
############ Script for svn ########################################################
## This script is used for to add those files which are not added into SVN. ##
## This script is also used do delete the files which have the extension .bak. ##
## this script provide the " svn commit/update with message " ##
## there are three section in this script ##
# SECTION I -------- for removes the *.bak files ##
# SECTION II ------- for add the files into svn repository ##
# SECTION III ------ for svn commit with message and without message ##
####################################################################################
#### ********** ANIL RATHOD ************* ###
####################################################################################
clear
path="/path_of_svn_Directory "
cd $path
########SECTION -I: Remove the *.bak
DELETECOUNT=`svn status | grep ".bak" |wc -l`
if [ $DELETECOUNT = "0" ]
then
until [ $DELETECOUNT -lt "0" ]
do
echo "All file with having *.bak are deleteing ....Please wait ."
DELETE=` svn status | grep ".bak" | awk {'print $2'} | head -$DELETECOUNT | tail -1 `
rm -rf $DELETE
echo "All .bak Files are Deleting .............. "
DELETECOUNT=`expr $DELETECOUNT - 1 `
done
fi
#########SECTION -II : Add file section
COUNT=`svn status | grep ^? |wc -l`
until [ $COUNT -lt "0" ]
do
CURRENT=`svn status | grep ^? |awk {'print $2'} | head -$COUNT | tail -1`
echo "Are you want to add $CURRENT file ? (y/n/skip)..."
read ANS
if [ $ANS = "y" ]
then
svn add $CURRENT
echo "**** FILE $CURRENT ADDED **** "
else if [ $ANS = "n" ]
then
echo "*** File $CURRENT NOTADDED ***"
else if [ $ANS = "skip" ]
then
break
fi
echo "Please Insert proper option........... "
sleep 1
exit
fi
fi
COUNT=`expr $COUNT - 1 `
done
#############SECTION -III : svn COMMIT
echo "Are you want to COMMIT ..........(y/n/skip)"
read COMMITANS
if [ $COMMITANS = "y" ]
then
echo "Enter your commitment MESSAGE....... "
read MSG
#***svn commit -m "$MSG_`date +%F`"
echo "svn Commited with message :- $MSG `date +%F`"
else if [ $COMMITANS = "n" ]
then
echo "Enter your commitment MESSAGE....... "
read MSG
#***svn commit -m "$MSG_`date +%F`"
echo "svn Commited with message :- $MSG `date +%F`"
else if [ $COMMITANS = "n" ]
then
echo "*************************"
echo "COMIITED without message"
echo "*************************"
#***svn commit -m "without_message_commited_on_`date +%F`"
exit
else if [ $ANS = "skip" ]
then
break
fi
else
echo "Please Insert proper option........... "
sleep 1
exit
fi
fi
Anil V. Rathod
Linux System Administrator
Kalinga Data Link Pvt. Ltd.Pune
Cell No. 986006217