如何编辑Subversion中已提交的日志消息? [英] How to edit log message already committed in Subversion?

查看:73
本文介绍了如何编辑Subversion中已提交的日志消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Subversion中编辑某个修订版本的日志消息?我不小心在提交消息中输入了错误的文件名,以后可能会引起混淆。

Is there a way to edit the log message of a certain revision in Subversion? I accidentally wrote the wrong filename in my commit message which could be confusing later.

我见过 如何在Git中编辑错误的提交消息? ,但是解决方案这个问题对于Subversion似乎并不相似(根据 svn help commit )。

推荐答案

基本上,您必须具有(直接或间接)存储库的管理员权限才能执行此操作。您可以配置存储库以允许所有用户执行此操作,也可以直接在服务器上修改日志消息。

Essentially you have to have admin rights (directly or indirectly) to the repository to do this. You can either configure the repository to allow all users to do this, or you can modify the log message directly on the server.

请参见这部分 Subversion常见问题解答(重点是我的):

See this part of the Subversion FAQ (emphasis mine):


日志消息作为每个修订版附加到
的属性保存在
存储库中。 默认情况下,日志
消息属性(svn:log)一旦提交,就无法进行
的编辑
。那是
,因为对修订版属性
(其中svn:log是一个)的更改导致
属性的先前值被永久丢弃,而Subversion
试图防止您意外地执行此
。但是,有
种方法可以将Subversion转换为
来更改修订版属性。

Log messages are kept in the repository as properties attached to each revision. By default, the log message property (svn:log) cannot be edited once it is committed. That is because changes to revision properties (of which svn:log is one) cause the property's previous value to be permanently discarded, and Subversion tries to prevent you from doing this accidentally. However, there are a couple of ways to get Subversion to change a revision property.

第一种方法是用于存储库
管理员启用修订
属性。通过创建一个称为
的钩子 pre-revprop-change,可以完成
的操作(有关如何执行此操作的更多
信息,请参见Subversion本书中的
一节)。
pre-revprop-change挂钩在
更改之前已经可以访问
到旧日志消息,因此它可以用
的方式保存它(例如,通过发送
电子邮件)。启用修订版属性
修改后,您可以
通过
来更改修订版的日志消息,将--revprop开关传递给svn
propedit或svn propset,例如
其中之一:

The first way is for the repository administrator to enable revision property modifications. This is done by creating a hook called "pre-revprop-change" (see this section in the Subversion book for more details about how to do this). The "pre-revprop-change" hook has access to the old log message before it is changed, so it can preserve it in some way (for example, by sending an email). Once revision property modifications are enabled, you can change a revision's log message by passing the --revprop switch to svn propedit or svn propset, like either one of these:

$svn propedit -r N --revprop svn:log URL 
$svn propset -r N --revprop svn:log "new log message" URL 

其中N
是您希望更改其日志
消息的修订号,URL为存储库位置
。如果您
在有效的
副本中运行此命令,则可以省略URL。

where N is the revision number whose log message you wish to change, and URL is the location of the repository. If you run this command from within a working copy, you can leave off the URL.

更改日志$ b的第二种方法$ b消息是使用svnadmin setlog。
这必须通过参考
文件系统中
存储库的位置来完成。您无法使用此命令修改远程
存储库。

The second way of changing a log message is to use svnadmin setlog. This must be done by referring to the repository's location on the filesystem. You cannot modify a remote repository using this command.

$ svnadmin setlog REPOS_PATH -r N FILE

其中REPOS_PATH是存储库
的位置,N是修订号
,其版本号您希望更改的日志消息
和FILE是一个包含新
日志消息的文件。如果
pre-revprop-change挂钩不在
位置(或者您出于某种原因要绕过挂钩
脚本),您也可以
使用- -bypass-hooks选项。
但是,如果您决定使用此
选项,请务必小心。您可能会绕过
,例如通过电子邮件发送
更改通知,或备份跟踪修订
属性的
系统。

where REPOS_PATH is the repository location, N is the revision number whose log message you wish to change, and FILE is a file containing the new log message. If the "pre-revprop-change" hook is not in place (or you want to bypass the hook script for some reason), you can also use the --bypass-hooks option. However, if you decide to use this option, be very careful. You may be bypassing such things as email notifications of the change, or backup systems that keep track of revision properties.

这篇关于如何编辑Subversion中已提交的日志消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆