Post-commit hook using VisualSVN Server

1.7k views Asked by At

I am using Windows Apache, MySQL, VisualSVN server and the TortoiseSVN client.

We have a multi-system environment. I have a working copy (root directory folder) of my website which is working to serve as live.

There are various users regularly committing changes to the website to the SVN server but these commits are not updated on the live website working copy.

I am looking for the exact process to be followed to implement a post-commit hook to auto-update the live website working copy. What do I need to do to implement this?

1

There are 1 answers

1
mliebelt On BEST ANSWER

You description is not sufficient (yet). So I describe something that could possibly work (I don't like it ...).

  1. Create a repository on server X.
  2. Checkout part of the repository (that you want to be the live part) on the server X in directory svn-web.
  3. Ensure that svn-web is served by apache, and try to hide the directory svn-web/.svn, so that it is not visible to the users through the browser. Or serve only a sub-directory of svn-web by Apache, so svn-web/.svn is hidden automatically.
  4. Implement a post-commit-hook (like described in SVN Red Book).
  5. Include in that hook the following: cd svn-web; svn update .

Then the following will happen:

  1. A developer changes some part of the directory tree of svn-web locally.
  2. When he has finished his changes, he will commit them.
  3. If the commit is successful (pre-commit does not deny it), the post-commit hook will be triggered.
  4. An update will be done on the server in the checked out directory, so that the next web request will see the different sources.

Why I don't like it?

  • Not every commit in Subversion is self-contained, so there may be intermediate states that are not "nice" for the end user.
  • There is no test, integration, ... phase to find bugs before they are found by the end user.