Repository management via SVN, after each commit, the SVN server updates the latest uploaded version to the Web directory for synchronization. The operation is cumbersome, and the efficiency is low. Using the SVN hook script for Web directory synchronization can be a good solution to this problem. Because the test machine is in the same machine as the SVN repository, it is easier to handle.
There is a hooks directory underneath the SVN project, which contains all the templates for the hook script
Post-commit.tmpl triggered after a client commit commit
Here's how to automatically update the repository under Windows and Linux:
In the hooks directory under the storage directory of the SVN project repository, create a new Post-commit.bat file:
Windows:
@echo off
SET repos=%1
SET rev=%2
SET Dir=%repos%/hooks
SET path=%path%;
SET working=e:/www/o135
SVN update%working%--username o135--password o135123
Note: The above method must be added to the path path (environment variable) of the bin in the SVN server installation directory. SVN installs through Setup, and the bin directory is added to the path path by default, and must be manually incremented if installed through a compressed package.
To know if this script is an error, you can enter: C:\Documents and settings\administrator>e:/svn/hooks/post-commit.bat on the cmd command line to test. The following message appears to indicate that the script executed successfully:
C:\Documents and Settings\administrator>e:/svn/hooks/post-commit.bat
Upgrading ' e:\www\o135′:
Version 15.
The red part is the location of the repository, which is modified by the actual location.
In the future, this script will be triggered automatically by the SVN commit command, regardless of the machine, in the Web directory.
Linux:
Linux works the same way as Windows does. The new file name is not the same.
In the hooks directory under the storage directory of the SVN project repository, create a new Post-commit file:
VI Post-commit
Add the following code:
#!/bin/sh
web=/home/data/o135
Export Lang=en_us. UTF-8
SVN update $WEB--username o135--password ' o135123 '
Save, Exit:
Permission to give this script:
chmod 777 Post-commit
Test to see if the script has permission issues
./post-commit
The script is automatically run every time the client commits the operation.
Windows,linux SVN implementation of Automatic Update web directory