svn强制commit写log
https://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-howto-minlogmsgsize.html
Force users to enter a log message
There are two ways to prevent users from committing with an empty log message. One is specific to TortoiseSVN, the other works for all Subversion clients, but requires access to the server directly.
If you have direct access to the repository server, you can install a pre-commit hook script which rejects all commits with an empty or too short log message.
In the repository folder on the server, there's a sub-folder hooks
which contains some example hook scripts you can use. The file pre-commit.tmpl
contains a sample script which will reject commits if no log message is supplied, or the message is too short. The file also contains comments on how to install/use this script. Just follow the instructions in that file.
This method is the recommended way if your users also use other Subversion clients than TortoiseSVN. The drawback is that the commit is rejected by the server and therefore users will get an error message. The client can't know before the commit that it will be rejected. If you want to make TortoiseSVN have the
TortoiseSVN uses properties to control some of its features. One of those properties is the tsvn:logminsize
property.
If you set that property on a folder, then TortoiseSVN will disable the
For detailed information on those project properties, please refer to the section called “Project Settings”.
具体操作
# On a Windows system, you should name the hook program
# 'pre-commit.bat' or 'pre-commit.exe',
# but the basic idea is the same.
需要注意的是, pre-commit.tmpl仅存在于具体的svn的repository中,并不存在于visual svn server的安装目录下。
直接使用everything,搜索pre-commit。然后按照文件内的说明,重命名为bat文件。结果发现默认的不能用
找到如下的脚本,直接将内容复制,然后覆盖原来的内容
https://stackoverflow.com/questions/1928023/how-can-i-prevent-subversion-commits-without-comments
You can use a hook (put it into <repository>/hooks
and name it pre-commit.bat
(Windows)):
@echo off :: :: Stops commits that have empty log messages. :: setlocal rem Subversion sends through the path to the repository and transaction id set REPOS=%1 set TXN=%2 rem check for an empty log message svnlook log %REPOS% -t %TXN% | findstr . > nul if %errorlevel% gtr 0 (goto err) else exit 0 :err echo. 1>&2 echo Your commit has been blocked because you didn't give any log message 1>&2 echo Please write a log message describing the purpose of your changes and 1>&2 echo then try committing again. -- Thank you 1>&2 exit 1
src: http://www.anujgakhar.com/2008/02/14/how-to-force-comments-on-svn-commit/
遇到问题'svnlook' is not recognized as an internal or external command,
1.把这个目录配置到环境变量
C:\Program Files (x86)\VisualSVN Server\bin
2.然后重启VisualSvnServer这个windows service
如果svn的repository太多的话,可以写一个脚本,来自动复制pre-commit.bat
http://kockerbeck.blogspot.com/2010/08/require-comment-message-on-all-svn.html
@ECHO OFF :: ------ SVN Deploy Hooks ------ :: ----- by Mark Kockerbeck ---- :: ------ Configuration --------- SET HookDirectory=C:\CommonHooks SET RepositoryDirectory=C:\Repositories :: ------ /Configuration -------- pushd %HookDirectory% for /r %%i in (*) do ( for /D %%j in (%RepositoryDirectory%\*) do ( echo Copying %%i to %%j\hooks\ copy %%i %%j\hooks\ ) ) popd
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2017-03-27 win7笔记本设置wifi热点
2016-03-27 依赖倒置