2
votes

I m setting up SVN on my local web development server and I'm wanting to create a post-commit hook that exports the repo to the production server (either via FTP, SSH, etc) when the commit message contains the word "deploy" or something similar. I know this has to be a common function for SVN but I can't seem to find anything that does just this. Maybe another set of eyes will lead me to the correct solution...

Thanks in advance!

3
I'm not sure about how to create a post-commit action, but you might want to consider deploying into development server first. SVN is intended for development (where you can make mistakes) and that's where it shines. Using it only for production is limiting how much power it really has. You can get more out of SVN by using it as a versioning system for your development (commit often) and then exporting your files to FTP when you're ready to deploy. Just my two cents.lewiguez

3 Answers

2
votes

One thing I have done (on projects specifically designed for this type of release) is to checkout the project into my production server, then do an svn update on it when the code is ready to be moved to production.

1
votes

As others have suggested, I'm not a huge fan of this. I've written post-commit hooks that update third-party ticketing, etc. systems via their HTTP APIs, and I'm not thrilled at the time it takes to actually commit a revision that matches the criteria--I think I'd be less thrilled if I had to wait for it to upload actual binaries to another server, even if it were on the same subnet. We also currently check in our builds from the build server and just check them out on the deployment servers, which is easily automatable.

0
votes

Check out the documentation on post-commit hooks, as well as some basic examples. A google search for "svn post-commit hook" pulls up lots of examples.