[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Windows Hook Script - Automatic web publishing

From: John Browne <jkbrowne_at_gmail.com>
Date: 2005-04-23 17:13:29 CEST

We have several web applications versioned through subversion. We
have a dedicated apache box for our repository. On our live
webserver, we have a single shell script that does a "svn update" for
all of the web apps. We also scheduled this shell script to run in a
cron job every 15 minutes. So, whenever we commit changes to the
subversion box, they get published on the live webserver at the next
15-minute interval. Or, if it's something critical, we can commit,
then login to the live webserver & run the shell script manually.

This solution has worked well for us for about a year now. It also
has the added benefit that it is easy to disable temporarily if need
be.....instead of having to mess with a hook script that may currently
be in use you can just comment out the cron job.

Hope this helps. YMMV..

On 4/22/05, WysG <wysg@hextudio.com> wrote:
> To make a short story long :)
> Currently, at work, the dev environnment(for web application) is set up
> like this
> webdev\
> webdev\app1\somefile.asp
> webdev\app2\someotherfile.asp
> webdev\app3\blabla.asp
> And it's dirrectly on the web server so we can instantlly test our
> changes, but you guest it right, working on the same file as a co-worker
> is a pain where the sun don't shine and we don't have versionning of files.
> So obviously we need a version control system and the choice, after
> checking all systems available, stoped on Subversion. But we would need
> a hook script that "publish" automaticly our changes on the web server.
> So here's the pseudo-code for what would the hook script looks like, I'd
> need to do this in a Windows batch file or a C/C++ program, but it can't
> be in perl or python aren't installed on this Windows Server and won't
> be :'(
> ----
> /* The hook receive two arguments
> [1] REPOS-PATH (the path to this repository)
> [2] REV (the number of the revision just committed)
> */
> strPath = [1]
> intRev = [2]
> arrDirsChanged = Execute "svnlook dirs-changed strPath -r intRev" /* If
> I do this as a C/C++ program, how can I execute a command and get the
> data back */
> /*
> The data return by svnlook dirs-changed looks like this :
> /
> app2/
> app2/trunk/
> app2/trunk/someotherfile.asp
> */
> /* Obviously the initial check out would have been done initialy manualy */
> for each arrDirsChanged as strDirChanged
> IF Part of strDirChanged = app1/trunk
> Do svn update in Webserver_root/webdev/app1
> IF Part of strDirChanged = app2/trunk
> Do svn update in Webserver_root/webdev/app2
> IF Part of strDirChanged = app3/trunk
> Do svn update in webserver_root/completly_different_path/
> /* End For Each*/
> ----
> So the question to all Subversion guru is : Is this the correct way to
> do it ? Is there any other way that I'm not seeing. Is this possible as
> a Batch file ? If yes how ?
> Thanks in advance for any advice.
> ---
> WysG
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org

To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sat Apr 23 17:15:16 2005

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.