How to run the hook script in Subversion

Source: Internet
Author: User
Article Title: how to run the hook script in Subversion. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Subversion is a powerful version control system, especially it can easily process data on various points in the library management process. You can own the script handle data after submission, before submission, or locking or unlocking a file, or in other cases. All of these are implemented through hooks, which are part of the subversion library structure. The Hook is triggered by a library event. For example, if you have a subversion inventory under/subversion/repos/packages, your hook will be stored in the/subversion/repos/packages/hooks directory.

A large number of temporary files are stored in this hook directory. These files exist only as examples. So if you want to write a script that sends the subversion data to you via e-mail after each commit, you should copy the post-commit.tmpl to post-commit, change it to executable and edit it as needed.

These scripts can be obtained from the subversion website, and some scripts and tools provided by other users. You can view many of these scripts on http://subversion.tigris.org/tools_contrib.html. Currently, the most interesting is the post-commit e-mail script commit-email.pl. Download the file and put it under/usr/local/bin/, and make it executable. In the hooks/post-commit script, add the following content to the end of the file:

REPOS = ""

REV = ""

/Usr/local/bin/commit-email.pl "$ REPOS" "$ REV" -- from svn@myhost.com-s

"SVN commit in packages" joe@myhost.com

This will execute the commit-e-mail.pl script with some parameters, that is, the Library name and your revision. It sends e-mail from the svn@myhost.com site to the joe@myhost.com Based on the specified theme route, and some specified users or email lists on the joe@myhost.com site.

If you want to view other scripts on the site, you can see many interesting scripts in the Manager of the version control software library. Before the entire data is submitted to subversion, these scripts can perform certain checks, such as various pre-commit check scripts.

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.