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

Re: hook deployment script [trying svn up]

From: Neil Obremski <weenie_at_gmail.com>
Date: 2007-03-13 22:26:42 CET

For a post-commit hook script on Windows, I suggest you have a separate
Scheduled Task setup to do it. You can set it to run on demand and then in
a post-commit.CMD launch it like so:

    SCHTASKS /Run /TN "Name of task"

Scheduled Tasks can be launched by the LOCAL SYSTEM account that Apache runs
under, but have their own set of credentials to use. This way you don't
have to run Apache under a domain account and if the task takes a long time,
it won't tie up Apache.

One caveat, since you can't pass parameters to the scheduled task you'll
need to have it get its information (repository location, revision #) from
some other place. What I've done in these cases is have the
post-commit.CMDdump a flat file into a specific directory. The
scheduled task can then
look in this directory for files to serve as "things to do". Two nice side
effects of this is 1.) you can test the scheduled task without commits, and
2.) you can move the files to a "log" folder afterwards to keep track of
what's been done.

Things are simpler in your case if all you want to do is run SVN UPDATE from
a specific repository to a working copy, because you can write it with the
hard-coded values and not need parameters.

For more info on using SCHTASKS, or other command-line tricks on Windows, I
suggest starting at http://www.ss64.com/.

On 3/13/07, Ryan Schmidt <subversion-2007a@ryandesign.com> wrote:
> On Mar 12, 2007, at 09:21, smakawhat wrote:
> >> > My understanding from what I have been googling is you can write
> >> > these in any language just make it executable. I notice I think
> >> > most people tend to write them in PERL.
> >> >
> >> > My question is how do I know what to copy in the script cause I
> >> > want to copy only what is new. Being doing some Googlin and just
> >> > finding lots of email examples but nothing related to copying (kind
> >> > of like deploying), or use of variables, syntax meaning etc...
> >>
> >> Your post-commit hook is given the path to the repository and the
> >> revision number. You can pass that information to "svnlook changed"
> >> to determine what changed.
> >>
> >> Rather than writing the rather complicated script needed to properly
> >> handle additions, modifications and removals of files and directories
> >> in this fashion, you could just make the directory on the server a
> >> working copy, and issue an "svn up" command in the post-commit hook
> >> to get it updated.
> >
> > I decided to go with the idea of making a working copy in the
> > website development server. In order to do this do I had to
> > recreate a new folder and rename it cause it was what I originally
> > imported.
> >
> > I took my local copy on my workstation, commited the changes. I
> > went to a command prompt first and used the svn up command to see
> > if the file in the repository would transfer up. I typed in C:\svn
> > up but I got the message: Skipped ','
> >
> > Any ideas?
> So you have a working copy on the server somewhere, which is used to
> serve the web site. Your web server's configuration files point at
> this working copy. The working copy is in, let's say, C:\Documents
> \MyWebSite, because you ran, say, "svn checkout $REPO/path/to/
> mywebsite/trunk C:\Documents\MyWebSite"
> Then your post-commit hook should contain the line "C:\Path\To
> \svn.exe C:\Documents\MyWebSite"
> --
> To reply to the mailing list, please use your mailer's Reply To All
> function
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Mar 13 22:27:08 2007

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.