Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

svn ADD and COMMIT in one command (See related posts)

// description of your code here

#!/bin/sh

#####################################################################################
### ADD                                                                           ###
#####################################################################################

INDADDALL="n";
ADDANS="n";

for CURRENT in `/opt/subversion/bin/svn st | grep ? | awk -F "      " '{print $2}'`; 
do 
        if [ $INDADDALL = "n"  ] 
        then
          echo "### ADD #####################################################";
          echo "??? Are you want to add $CURRENT file ? (y/n/yesall/skip)...";
          read ADDANS;
        fi
        if [ $ADDANS = "n"  ] 
        then
          echo "!!! $CURRENT...not added!"
        fi

        if [ $ADDANS = "yesall" ] 
        then
          INDADDALL="y";
        fi     

        if [ $ADDANS = "skip" ]
        then
           break
        fi

        if [ $ADDANS = "y" ] 
        then
          /opt/subversion/bin/svn add $CURRENT
          #echo "svn add $CURRENT...added!";
        fi
        if [ $INDADDALL = "y" ] 
        then
          /opt/subversion/bin/svn add $CURRENT
          #echo "svn add $CURRENT...added!";
        fi

     sleep 1
done

#####################################################################################
### UPDATE                                                                        ###
#####################################################################################

echo "### UPDATE ########################################################";
echo "??? Are you want to UPDATE your working directory..........(y/skip)"
read UPDATEANS
if [ $UPDATEANS = "y" ]
then
    /opt/subversion/bin/svn update
    #echo "svn Updated"
fi
if [ $UPDATEANS = "skip" ]
then
   break
fi

#####################################################################################
### COMMIT                                                                        ###
#####################################################################################

echo "### COMMIT #############################################################";
echo "??? Are you want to COMMIT whith a comitment message..........(y/n/skip)"
read COMMITANS
if [ $COMMITANS = "y" ]
then
    echo "??? Enter your commitment MESSAGE....... "
    read MSG
    /opt/subversion/bin/svn commit -m "$MSG_`date +%F`"
    # echo "svn Commited with message :- $MSG `date +%F`"
fi
if [ $COMMITANS = "n" ]
then
    /opt/subversion/bin/svn commit -m "without_message_commited_on_`date +%F`"    
fi
if [ $COMMITANS = "skip" ]
then
   break
fi


You need to create an account or log in to post comments to this site.