Windows SVN forced log writing hook script enhanced version (space filter)

Source: Internet
Author: User

SVN is widely used in software development for source code management. By default, every commit of SVN does not require log information. To facilitate management, the project team usually needs to add the log filling habit. You can configure the svn hook to implement function management. Generally, the following is a script for force Log Hook in Windows:

@ Echo off
Setlocal
Set repos = % 1
Set txn = % 2
Rem ensures that the input is 8 characters long
Svnlook log % repos %-T % txn % | findstr "......"> NUL
If % errorlevel % gtr 0 Goto: err_action

Goto: Success
: Err_action
Echo you did not enter any change log description information in this version submission.> & 2
Echo, add the log description and then submit the Code, for example, function description.> & 2
The log information entered by ECHO cannot exceed 8 characters (or 4 Chinese characters). Thank you! > & 2

Goto: err_exit
 
: Err_exit
Exit 1
 
: Success
Exit 0


Although the above script can control the log information input, the defect is that if space data is input, such as eight consecutive spaces, this script cannot be filtered, the log information is null. The preceding enhanced space filtering script is as follows:

@ Echo off
Setlocal

Set repos = % 1
Set txn = % 2

Rem ensures that the input is 8 characters long
Svnlook log % repos %-T % txn % | findstr "......"> NUL
If % errorlevel % gtr 0 Goto: err_action

Rem filter space characters
Svnlook log % repos %-T % txn % | findstr/IC: ""> NUL
If % errorlevel % gtr 0 Goto: Success
 
: Err_action
Echo you did not enter any change log description information in this version submission.> & 2
Echo, add the log description and then submit the Code, for example, function description.> & 2
The log information entered by ECHO cannot exceed 8 characters (or 4 Chinese characters). Thank you! > & 2
Echo *****************> & 2

Goto: err_exit

: Err_exit
Exit 1
 
: Success
Exit 0


This enhanced script is used in the project team of the author. The function is normal and the space filtering function is implemented. For more information, see.











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.