In windows, svn restricts the forcible Writing of logs and only the script for modifying your own logs.

Source: Internet
Author: User
Tags svn client

The usage of hook in svn has been seldom noticed. Today I have seen this article on the Internet and it is very useful for sharing.

In fact, it can be better explained that the powerful batch processing address: http://blog.csdn.net/qiutaox/archive/2008/11/22/3349899.aspx

The original article is as follows:

 

The following is an absolutely available script I tested under svn1.5. I want to share the correct script with you, some of my friends who are too big by incorrect scripts are helpful.

1. Modify the log function of the svn client (and you can only modify your own logs)
Locate the hooks directory in the repository, copy the pre-revprop-change.tmpl file as a pre-revprop-change.bat file, and change the pre-revprop-change.ba file content:

Set repos = % 1
Set rev = % 2
Set user = % 3
Set propname = % 4
Set action = % 5

For/f "usebackq" % k in ('svnlook author % repos %-r % rev % ') do @ set var = % k

Set rightUser = 0
If "% 3" = "% superUser %" set rightUser = 1
If "% 3" = "% var %" set rightUser = 1

If % rightUser % = 0 goto ERROR_USER

Goto: SUCCESS_EXIT

: ERROR_USER
Echo only allows users to modify their own logs> & 2
Goto ERROR_EXIT

: ERROR_EXIT
Exit 1

: SUCCESS_EXIT
Exit 0

2. Go to the hooks directory in the repository, copy the pre-commit.tmpl file as a pre-commit.bat file, and then change the content of the pre-commit.bat file:
Setlocal
Set REPOS = % 1
Set TXN = % 2
Rem check that logmessage contains at least 5 characters
Svnlook log "% REPOS %"-t "% TXN %" | findstr "......"> nul
If % errorlevel % gtr 0 goto err
Exit 0
: Err
Logs must be written for echo submission.> & 2
Exit 1

Related Article

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.