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