[Z] For SVN servers in Windows, you must submit the modification comments.

Source: Internet
Author: User
1. Force Add comment information

Find the hooks directory in the corresponding project under the respositories directory to create a pre-commit.bat file, copy the following content:

 

@ Echo offset svnlook = "C: \ Program Files \ visualsvn \ bin \ svnlook.exe "setlocalset repos = % 1 Set txn = % 2rem check that logmessage contains at least 10 characters % svnlook % log" % repos % "-t" % txn % "| findstr ".......... "> nulif % errorlevel % gtr 0 goto errexit 0: errecho empty log message not allowed. commit aborted! 1> & 2 exit 1

 

 

 

2. allow users to modify comments

Find the hooks directory in the corresponding project under the respositories directory to create a pre-revpos-change.bat, copy the following content:

@ Echo off
Set repos = % 1
Set REV = % 2
Set User = % 3
Set propname = % 4
Set action = % 5

:::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::
: Only allow changes to SVN: log. The author, date and other Revision
: Properties cannot be changed
:::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::
If/I not '% propname %' = 'svn: log' goto error_propname

:::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::
: Only allow modifications to SVN: log (no addition/overwrite or deletion)
:::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::
If/I not '% action %' = 'M' goto error_action

:::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::
: Make sure that the new SVN: Log message contains some text.
:::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::
Set bisempty = true
For/F "tokens = *" % G in ('Find/V "" ') Do (
Set bisempty = false
)
If '% bisempty %' = 'true' goto error_empty

Goto: EOF



: Error_empty
Echo empty SVN: log properties are not allowed.> & 2
Goto error_exit

: Error_propname
Echo only changes to SVN: log revision properties are allowed.> & 2
Goto error_exit

: Error_action
Echo only modifications to SVN: log revision properties are allowed.> & 2
Goto error_exit

: Error_exit
Exit/B 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.