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.