有时候需要对之前版本提交的错误的日志信息进行修改或者进行补充描述:

1、在windows 7( 64位 )下使用TortoiseSVN客户端,选中代码目录,点击右键,选择<显示日志>

在出来的日志列表对话框中,选择某个提交版本,再点击右键,选择<编辑日志信息>,如下图所示:

我们修改原来空白的日志信息

万恶报错信息出现了

这个时候怎么处理呢??难道SVN不爱我们了!!

由于缺省情况下为安全起见Subversion不允许开发人员修改已提交reversion的日志信息,这样会报错误,提示不能修改以及请SVN管理员安装pre revprop change hook。

visualSVN Server每个Repositories下都有一个hooks文件夹,如下图,已经有一堆tmpl文件,这些文件其实就是linux 的shell脚本模板。

我们先打开pre-revprop-change.tmpl来看看,pre-revpro-change.tmpl就是linux版的pre-revprop-change hook的模板,在linux下赋予执行权限就可以使用

 #!/bin/sh

 # PRE-REVPROP-CHANGE HOOK
#
# The pre-revprop-change hook is invoked before a revision property
# is added, modified or deleted. Subversion runs this hook by invoking
# a program (script, executable, binary, etc.) named 'pre-revprop-change'
# (for which this file is a template), with the following ordered
# arguments:
#
# [1] REPOS-PATH (the path to this repository)
# [2] REV (the revision being tweaked)
# [3] USER (the username of the person tweaking the property)
# [4] PROPNAME (the property being set on the revision)
# [5] ACTION (the property is being 'A'dded, 'M'odified, or 'D'eleted)
#
# [STDIN] PROPVAL ** the new property value is passed via STDIN.
#
# If the hook program exits with success, the propchange happens; but
# if it exits with failure (non-zero), the propchange doesn't happen.
# The hook program can use the 'svnlook' utility to examine the
# existing value of the revision property.
#
# WARNING: unlike other hooks, this hook MUST exist for revision
# properties to be changed. If the hook does not exist, Subversion
# will behave as if the hook were present, but failed. The reason
# for this is that revision properties are UNVERSIONED, meaning that
# a successful propchange is destructive; the old value is gone
# forever. We recommend the hook back up the old value somewhere.
#
# On a Unix system, the normal procedure is to have 'pre-revprop-change'
# invoke other programs to do the real work, though it may do the
# work itself too.
#
# Note that 'pre-revprop-change' must be executable by the user(s) who will
# invoke it (typically the user httpd runs as), and that user must
# have filesystem-level permission to access the repository.
#
# On a Windows system, you should name the hook program
# 'pre-revprop-change.bat' or 'pre-revprop-change.exe',
# but the basic idea is the same.
#
# The hook program typically does not inherit the environment of
# its parent process. For example, a common problem is for the
# PATH environment variable to not be set to its usual value, so
# that subprograms fail to launch unless invoked via absolute path.
# If you're having unexpected problems with a hook program, the
# culprit may be unusual (or missing) environment variables.
#
# Here is an example hook script, for a Unix /bin/sh interpreter.
# For more examples and pre-written hooks, see those in
# the Subversion repository at
# http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and
# http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/ REPOS="$1"
REV="$2"
USER="$3"
PROPNAME="$4"
ACTION="$5" if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi echo "Changing revision properties other than svn:log is prohibited" >&2
exit 1

VisualSVN server运行在Windows平台,所以这些hook脚本是不可能能执行的。但只要照着这些hook模板代码的逻辑用bat脚本重写这些脚本,就可以实现windows下的hook.

pre-revprop-change.bat代码如下

 setlocal
set REPOS=%
set REV=%
set USER=%
set PROPNAME=%
set ACTION=%
if not "%ACTION%"=="M" goto refuse
if not "%PROPNAME%"=="svn:log" goto refuse
goto OK
:refuse
echo Cann't set %PROPNAME%/%ACTION%, only svn:log is allowed 1>&2
endlocal
exit
:OK
endlocal
exit

好了现在重新开始测试

难道SVN不爱我们了吗,不是,原来是我们不懂SVN的心

小技巧

如果不想在中添加bat文件该怎么弄

将之前的 pre-revprop-change.bat中内容直接复制到这个里

好了我们还是测试一下吧

VisualSVN:允许修改svn提交日志(pre-revpro-change hook)的更多相关文章

  1. VisualSVN: 只能修改自己提交日志

    上回讲过怎么修改日志信息,这次想提交怎么只能修改自己提交的. 现在演示用户111来修改libra的日志信息 这个公正的SVN出现了 用户111说小样,不让我改,那我修改自己提交的日志总行了吧!! 我改 ...

  2. SVN无法修改以前提交日志的办法

    一直用SVN作为代码备份,但是今天偶然发现SVN上不能修改意见提交的代码,于是乎开始谷歌了,最后发现只需要在该工程下的hooks目录下放入pre-revprop-change.bat文件即可. pre ...

  3. 设置SVN提交日志必填

    1.打开visualSVN Server2.打开Repositories3.右键需要控制的项目->所有任务->manage hooks...4.选择Hooks tab,点击Pre-comm ...

  4. linux + svn提交日志不能显示 日期一直都是1970-01-01

    网上很多都是说将svn安装目录下的svnserve.conf文件中的anon-access 设置为read,但是 经查阅并测试, 设置为: anon-access = none  是正确的,设置成 r ...

  5. svn命令行修改已提交的版本备注

    svn命令行修改已提交的版本备注 参考文章: stackoverflow.com/questions/304383/how-do-i-edit-a-log-message-that-i-already ...

  6. 基于SVN提交历史筛选作者并修改文件内容

    笔者最近开发的项目中,是通过SVN做为版本管理工具的,因为需要创建的文件太多,所以有许多文件是在原有文件基础上拷贝过来修改的,这里就涉及到一个问题,原有文件中注释里填的JAVA类名.作者工号.创建时间 ...

  7. SVN修改已提交版本的日志

    在工作中一直是使用svn进行项目的版本控制的,有时候由于提交匆忙,或是忘了添加Log,或是Log内容写的有错误.今日遇到此类情况,想要在查看项目的日志时添加log或是修改log内容,遇到如下错误:Re ...

  8. SVN修改已经提交过记录的日志和作者

    原 SVN修改已经提交过记录的日志和作者 使用TortoiseSVN管理代码,对于已经提交的记录,可以修改提交作者和提交日志,不过会报如下错误: Repository has not been ena ...

  9. SVN服务器搭建之提交日志模版构建

    SVN服务器搭建之提交日志模版构建 日志提交有两种 一种是自己客户端设置提交日志模版,这个只适用于自己,没办法强制性运用到项目中,只能依照每个人的自觉性来处理. 第二种方法是SVN服务器设置提交日志模 ...

随机推荐

  1. Nginx 安装成Windows 服务方法

    1. 下载nginx windows版本 http://www.nginx.org 2. 下载微软的2个工具: instsrv.exe.srvany.exe 去微软网站下载安装Windows Serv ...

  2. c#数据库訪问返回值类型为SqlDataReader时使用using时注意的问题

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/u010512579/article/details/24011761 在封装通用 SQLSERVER ...

  3. ThinkPHP5 控制器中怎么实现 where id = 2 or id = 3 这个查询语句?

    使用 whereOr whereIn();  (来自 ★C̶r̶a̶y̶o̶n-杭州 ) 为什么不用数组啊,array('eq', array(1,2),'or') (来自 supler)

  4. spring4 知识点

    1 bean的 创建 1,直接在配置文件里面写一个带有@Bean注解的方法(返回值就是那个bena对象),(name等于 方法名) 2,使用 FactoryBean 接口(三个方法分别是创建,类型,单 ...

  5. Angular 4 管道

    一.date管道 1.html 2. 控制器中的定义brithday 3.效果图 如果时间格式 为: 我的生日是{{birthday | date:'yyyy-MM-dd HH:mm:ss'}} 则效 ...

  6. 【Reporting Services 报表开发】— 怎么根据当前表单的guid作为参数查询相关数据?

    select AId from FilteredA as CRMAF_FilteredA 用这个 作为一个DataSet1 , 然后添加在报表里面添加一个参数 @AId,设置的默认的查询为前面Data ...

  7. SVN同步

    SVN同步:1.在备份服务器上安装SVN,之后创建同名的库名2.在备机的Repositories的库文件夹下的hooks目录下,备份并修改pre-revprop-change.tmpl文件为pre-r ...

  8. ExtJS xtype 一览

    基本组件: xtype Class 描述 button Ext.Button 按钮 splitbutton Ext.SplitButton 带下拉菜单的按钮 cycle Ext.CycleButton ...

  9. [记录]js跨域调用mvc ActionResult扩展

    背景 最近2个项目中都用到了js跨域访问的知识,2个项目都需要主站与各个分站之间进行数据交互.状态同步等相关操作.浏览器本身是不允许进行跨域访问,在MVC中我们可以扩展一个方法来实现这个功能.在此大家 ...

  10. BASIC-20_蓝桥杯_数的读法

    示例代码: #include <stdio.h>#include <string.h>#define N 10 char num[N] = {0} ; void yuyin(i ...