Re: How can I parse the output of "svn update"? [SOLVED]
From: David Weintraub <qazwart_at_gmail.com>
Date: Tue, 12 Aug 2008 10:26:14 -0400
On Mon, Aug 11, 2008 at 9:02 PM, Daevid Vincent <daevid_at_daevid.com> wrote:
Not entirely true:
I sent you a private response which included an outline of a shell
I didn't send the response to the list because it had nothing to do
-- David Weintraub qazwart_at_gmail.com On Mon, Aug 11, 2008 at 9:02 PM, Daevid Vincent <daevid_at_daevid.com> wrote: > Well, since I got zero responses from this list, I'll post the solution that > the gracious people on the SVLUG list provided: > > > > #!/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 > Flagged Update" > > http://daevid.com/content/examples/snippets.php > > > > From: Daevid Vincent [mailto:daevid_at_daevid.com] > Sent: Friday, August 08, 2008 2:22 PM > To: users_at_subversion.tigris.org > Subject: How can I parse the output of "svn update"? > > > > Can someone show me a good way to parse the output of "svn update" via a > script (bash or php)? Or does anyone have a script that does something like > this already? > > > > There's a lot of files whizzing by and it's not always easy to spot if there > is an update.sql file listed. I want to append a comment to the screen that > says "Hey, don't forget to run the update.sql commands or your database will > be whack." It would also be nice if I could change the color (via ANSI > escape sequences) for that line too. > > > > 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 > I figure I can just re-use that name J. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org For additional commands, e-mail: users-help_at_subversion.tigris.orgReceived on 2008-08-12 16:26:48 CEST |
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.