Windows,linux SVN implementation of Automatic Update web directory

Source: Internet
Author: User
Tags svn update

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.