diff --git a/poupdate b/poupdate index 1e85171..4233a3f 100755 --- a/poupdate +++ b/poupdate @@ -33,6 +33,10 @@ if [ ! $DIFF ]; then echo -e $RED"This program suggests the diff utility."$ENDCOLOR fi +if [ ! $SVN ]; then + echo -e $RED"This program suggests the svn utility."$ENDCOLOR +fi + ## Declaring Functions function usage() { echo "Usage `basename $0` [options] " @@ -79,14 +83,14 @@ tpl_tree=$3 newtrans=`cd $upd_dir; find . -name "*.po"` total_files=`echo $newtrans | wc -w` skipped_files=0 -merged_files=0 +processed_files=0 changed_files=0 if [ "$option_verbose" = "Y" ]; then echo "Checking if updated files are in the specified directory ..." else - echo -ne "\r$merged_files/$total_files merged" + echo -ne "\r$processed_files/$total_files merged" fi if [ "$newtrans" == "" ]; then echo -e $RED"\t\t... no updated files found in: $upd_dir"$ENDCOLOR @@ -131,8 +135,8 @@ if [ `cd $tpl_tree; find ${updfile}t 2> /dev/null | wc -l` -lt 1 ]; then find ${updfile}t -print fi skipped_files=$(($skipped_files+1)) + processed_files=$(($processed_files+1)) continue - fi if [ `cd "$tra_tree"; find ${updfile} 2> /dev/null | wc -l` -lt 1 ]; then @@ -143,7 +147,9 @@ if [ `cd "$tra_tree"; find ${updfile} 2> /dev/null | wc -l` -lt 1 ]; then tplfile=`cd "$tpl_tree"; find ${updfile}t` secdir=`dirname "$tplfile"` cp "$upd_dir/$updfile" "$tra_tree/$updfile" - svn add "$tra_tree/$updfile" + if [ $SVN ]; then + $SVN add "$tra_tree/$updfile" + fi fi # perform msgmerge and other actions @@ -180,9 +186,9 @@ fi rm $tra_tree/${trafile}.old $tra_tree/${trafile}.new -merged_files=$(($merged_files+1)) +processed_files=$(($processed_files+1)) if [ ! "$option_verbose" = "Y" ]; then - echo -ne "\r$merged_files/$total_files merged" + echo -ne "\r$processed_files/$total_files processed" if [ $DIFF ] && [ ! $changed_files -eq 0 ]; then echo -ne ", $changed_files changed" fi @@ -193,7 +199,7 @@ fi done -echo -ne $BLUE"\r$merged_files/$total_files merged"$ENDCOLOR +echo -ne $BLUE"\r$processed_files/$total_files processed"$ENDCOLOR if [ $DIFF ] && [ ! $changed_files -eq 0 ]; then echo -ne $BLUE", $changed_files changed"$ENDCOLOR fi diff --git a/ths-variables b/ths-variables index e93fa3b..094df08 100644 --- a/ths-variables +++ b/ths-variables @@ -19,6 +19,7 @@ THS=".ths" # Binaries +SVN=`which svn 2> /dev/null` DIFF=`which diff 2> /dev/null` MSGATTRIB=`which msgattrib 2> /dev/null` MSGFILTER=`which msgfilter 2> /dev/null`