SVN hooks (hooks) automatically deploy code to web directories

Source: Internet
Author: User
Tags commit svn svn client svn update

Web directory:/hoem/www/project
SVN repository directory:/svn/project

1.cd/svn/project/hooks

2. New Post-commit, perform vim post-commit content as follows

#!/bin/sh repos= "$" rev= "$"
dir= "/home/www/project"
export Lang=en_us. UTF-8
curdate= ' date '
echo "Code Deployed by at $CURDATE, $REPOS, $REV" >>/svn/code_deploy.log
SVN Update $DIR--username admin--password 123456

Then

chmod +x Post-commit

3. To/HOME/WWW under Checkout project

SVN checkout svn://127.0.0.1/project/

When this step is accepted, submitting the code update on the customer service will automatically sync to the Web directory.
Attached SVN hook type
Server hooks:
There are 9 types of hooks on the SVN server, namely:
A. 2 Types of Locks
A1.pre-lock
Execute the script before locking the file
A2.post-lock
Execute the script after the file is locked

B. 2 Types of Unlocked
B1.pre-unlock
Execute the script before unlocking the file
B2.post-unlock
Execute the script after unlocking the file

c. 3 types of submissions

C1.start-commit
Executes the script before the client has yet to submit data to the server, that is, before the Subversion transaction (abbreviated as TXN) has been established
C2.pre-commit
After Subversion transaction is complete, execute the script before committing

C3.post-commit
After the commit is completed, the hook is executed after the version is successfully created, the commit is completed and cannot be changed, so the return value of this script is ignored.

D. 2 types of attributes

D1.pre-revprop-change
Execute the script before modifying the revision property

D2.post-revprop-change
After modifying the revision property, execute the script. Because the revision is completed and cannot be changed, the return value of this script is ignored (although the actual implementation seems to be that the correct execution of the script affects the property modification)

Client hooks:
The Tortoise SVN client has 6 hooks, respectively:
A. With regard to submissions

A1.start Commit Hook

A2.pre-commit Hook

A3.post-commit Hook

B. With regard to the updated

B1.start Update Hook

B2.pre-update Hook

B3.post-update Hook

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.