RE: How can I parse the output of "svn update"? [SOLVED]
From: Daevid Vincent <daevid_at_daevid.com>
Date: Mon, 11 Aug 2008 18:02:38 -0700
Well, since I got zero responses from this list, I'll post the solution that
#!/bin/sh
#
# Original idea and modifications: Daevid Vincent [daevid_at_daevid.com]
# The meat and potatoes: Jeremiah Wuenschel [jeremiah.wuenschel_at_gmail.com]
#
# version 2008-08-11 5:50pm
#
if [ $USER != "dev" ]
then
echo "You must run this as user 'dev'."
exit 1
fi
CURR=`pwd`
cd /home/prod
svn update | awk '
BEGIN {need_update=0;}
/update\.sql/{need_update=1;}
{print}
END {if(need_update) {
printf "'$(echo -e "\033[1;31m")'"
print ""
print "########################################################"
print " DON\047T FORGET TO RUN THE site/data/sql/update.sql "
print " sudo mysql prod
print "########################################################"
printf "'$(echo -e "\033[0m")'"
}}
'
cd $CURR
I've put it also on my website along with other snippets under "Subversion
http://daevid.com/content/examples/snippets.php
From: Daevid Vincent [mailto:daevid_at_daevid.com]
Can someone show me a good way to parse the output of "svn update" via a
There's a lot of files whizzing by and it's not always easy to spot if there
I'm thinking something like this:
dev_at_devbox ~ $ svnu
U site/batch/index_user.php
U site/apps/frontend/lib/myLoginValidator.class.php
U site/apps/frontend/modules/sidebar/templates/_signin.php
U site/apps/frontend/modules/content/actions/actions.class.php
U site/apps/frontend/modules/content/config/view.yml
U site/apps/frontend/templates/layout.php
U site/data/sql/update.sql
U site/apps/frontend/modules/foo/config/bar.yml
U site/apps/frontend/modules/foo/bar.php
########################################################
DON'T FORGET TO RUN THE site/data/sql/update.sql
########################################################
We're already in the habit of typing "svnu" as an alias to "svn update", so
|
This is an archived mail posted to the Subversion Users mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.