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.

Hook-script on the server

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 OK button disabled until the log message is long enough then please use the method described below.

Project properties

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 OK button in all commit dialogs until the user has entered a log message with at least the length specified in the property.

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,

https://serverfault.com/questions/165663/svnlook-is-not-recognized-as-an-internal-or-external-command-visualsvn-server

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

svn强制commit写log的更多相关文章

  1. SVN设置没有写log不能commit

    操作方法:在SVN的Repositories下,找到要配置的项目,在项目目录下找到hooks文件夹,在其下创建pre-commit.bat文件,把下面复制进去就可以了(无需重启,如果改动,保存bat文 ...

  2. CentOS下的svn强制用户提交时写日志

    问题:在项目提交时候不写日志,在后期查看修改历史时需要对比版本才知道提交原因.解决方案:在svn服务端通过hooks在提交时强制要求写日志.#!/bin/shREPOS="$1"T ...

  3. CentOS SVN强制用户提交时写日志

    问题:在项目提交时候不写日志,在后期查看修改历史时需要对比版本才知道提交原因.解决方案:在svn服务端通过hooks在提交时强制要求写日志.#!/bin/shREPOS="$1"T ...

  4. svn 强制用户添加注释 和 允许用户修改注释

    当我们用TortoiseSVN提交代码时,有很多人不喜欢写注释,导致以后代码版本多,也不清楚哪个版本到底改了什么东西.所以在提交的时候,我会强制要求添加注释.这是如何实现的?这个话题就涉及到了svn的 ...

  5. svn强制加注释才能提交

    进入库的hooks目录下 cp pre-commit.tmpl pre-commit 并对pre-commit加入运行权限 修改pre-commit内容如下 REPOS="$1" ...

  6. 关于Quartz.NET作业调度框架的一点小小的封装,实现伪AOP写LOG功能

    Quartz.NET是一个非常强大的作业调度框架,适用于各种定时执行的业务处理等,类似于WINDOWS自带的任务计划程序,其中运用Cron表达式来实现各种定时触发条件是我认为最为惊喜的地方. Quar ...

  7. 基于.Net Framework 4.0 Web API开发(3):ASP.NET Web APIs 异常的统一处理Attribute 和统一写Log 的Attribute的实现

    概述:  ASP.NET Web API 的好用使用过的都知道,没有复杂的配置文件,一个简单的ApiController加上需要的Action就能工作.但是项目,总有异常发生,本节就来谈谈API的异常 ...

  8. Java 写 Log

    . 一个最基本的例子 使用Logging框架写Log基本上就三个步骤 引入loggerg类和logger工厂类 声明logger 记录日志 下面看一个例子 //1. 引入slf4j接口的Logger和 ...

  9. Subversion代码提交中的org.apache.subversion.javahl.ClientException: svn: E200007: Commit failed异常解决

    : 在切换subversion服务器地址之后,发生的无法正确提交代码的问题org.apache.subversion.javahl.ClientException: svn: E200007: Com ...

随机推荐

  1. IntelliJ IDEA总是提示Cannot resolve symbol的解决方案

  2. D. Duff in Beach

    题意  数字串a[0---n-1], 通过不断的重复组成了 b[0,---l-1]l<10^18, 让你计算出 长度小于等于k的最长非递减子序列,满足,取得第 i 个取得是 L1 第i+1个取得 ...

  3. hdu5289 单调队列

    这题说的是给了 n个数 然后让你计算出所有区间中那些数的最大值减最小值小于k这样的区间有多少个 /* 这样我们给我们在处理过程中的区间做一些处理 我们在处理即将进来的数的时候我们并不知道他是不是我们区 ...

  4. Sitecore系统教程之模板理解

    Sitecore中的所有内容都是一个项目.模板也是如此.Sitecore中的模板是一个项目,它定义了其他项目的结构和行为.Sitecore中的每个项目都是某个模板的实例.模板还可以定义它分解成的部分和 ...

  5. Maven的配置指南

    Maven的配置指南  配置Maven Maven配置发生在3个级别: 项目 - 大多数静态配置发生在pom.xml中 安装 - 这是Maven安装时发生的一次性的配置过程 用户 - 这是Maven提 ...

  6. [转]LoadRunner 各个指标分析

    转载:https://www.cnblogs.com/dvbbs2012/p/4073635.html 我们要监视CPU,内存.硬盘的资源情况.得到以下的参数提供分析的依据.%processor ti ...

  7. 排序(I)

    NSSortDescriptor 排序 Person类 #import <Foundation/Foundation.h> @interface Person : NSObject @pr ...

  8. neuFlow&CNP-卷积计算加速器&神经网络加速芯片生态系统

    上周看到韩松毕业论文,扯出神经网络加速器EIE,刚好这周调研了一下neuFlow,扯出09年的一篇做卷积加速的文章,大牛Lecun Yan的学生做的,一晃眼,快十年了.也记录之. 这一套还没研究透,又 ...

  9. 四则运算 python

    2018103004四则运算练习软件项目报告   此作业的要求参见链接的任务三个人任务:https://mooc1-1.chaoxing.com/mycourse/studentstudy?chapt ...

  10. 使用yaml+groovy实现Java代码可配置化

    背景与目标 在使用函数接口和枚举实现配置式编程(Java与Scala实现),使用了函数接口和枚举实现了配置式编程.读者可先阅读此文,再来阅读本文. 有时,需要将一些业务逻辑,使用配置化的方式抽离出来, ...