SVN and tortoisesvn: Detailed description of how to modify logs and write logs forcibly.

Source: Internet
Author: User

Note that an error occurs when the bat is changed to a space.

 

1. Write logs forcibly

Two ways to write logs of a certain length when a commit is set:

1. Configure on the client

Use the client tool tortoisesvn
In the working copy directory, right-click tsvn, select attributes, and click Add.
Select tsvn: logminsize from the drop-down list.
Set the number of required bytes.

2. Configure on the server

Compile the script in the hooks directory of the Library (in fact, is the batch processing file) file: pre-commit.bat
Content:

@ Echo off
Setlocal
Set repos = % 1
Set txn = % 2
Rem check that logmessage contains at least 30 characters
"D: /program files/Apache Software Foundation/apache2.2/bin/svnlook "log" % repos % "-T" % txn % "| findstr ".......... .................... "> NUL
If % errorlevel % gtr 0 goto err
Exit 0
: Err
Echo that logmessage contains at least 30 alphanumeric characters. Commit aborted! 1> & 2
Exit 1

To modify the limit length, you only need to increase or decrease ".............................. "Number of midpoint.

Conclusion: Both methods are acceptable. The second method is recommended, which can play a mandatory role. The first method can be changed by anyone. It cannot be forced but can only be self-conscious.
Note: "D:/program files/Apache Software Foundation/apache2.2/bin/svnlook" find the installation path of the svnlook.exe file and use the absolute path.

2. Methods for modifying historical logs

It cannot be modified by default.

Add a batch file under the repository's hooks Directory: pre-revprop-change.bat

@ 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
:::::::::::::::: :::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::< BR >:: 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 1

Use tortoisesvn-> display log-> select to modify log-> right-click to edit log information.

However, there is a problem: the function of writing logs of a certain length is lost when the commit is set forcibly.

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.