I am working on a project that can’t be tested locally. So, I need to upload files to server. However, committing and then uploading is rigorous job (as there are lots of files to upload as a directory while changes were made only a few files under different directory. so browsing directory and uploading specific file(s) also annoying.) ! That’s why I used ‘svn up’ command to update all changed files from svn repository.
However, recently, I had to commit so frequent that committing and then updating server’s copy was also became irritating. So, today I tried to make a post commit hook that will update the server’s copy automatically after each commit. So, I just need to commit and then test on browser :).
The hook is simple. Just 3 lines of codes. Say my project’s svn repo is in /svn/project1, I have put the following code in /svn/project1/hooks/post-commit
svn up –username SVN_USERNAME –password SVN_PASSWORD
You need to put appropriate value instead of values written in block letters. Then make the file executable by the user who is running svnserve! The worse permission may be 555! But, I guess you know what you have to do :). Also, make sure svn user has permission to access your directory where to update!