Java代码中对Svn的Log进行再编辑,修改已经提交版本的Log
“svn:log”:要设置的property属性是log
msg:是修改后的注释内容
svnurl:是需要修改的全路径(http:xxx/xx)
/**
* SVN Set Log Message Property
*
* @param repoPath
* @param revision
* @param svnUser
* @param msg
* @throws SVNException
*/
public static void svnSetProp(String repoPath, Integer revision, SvnUser svnUser, String msg) throws SVNException {
ISVNOptions options = SVNWCUtil.createDefaultOptions(true);
svnClientManager = SVNClientManager.newInstance(
(DefaultSVNOptions) options, svnUser.getUserName(), svnUser.getPassword());
SVNURL svnurl = SVNURL.parseURIEncoded(repoPath);
SVNWCClient svnwcClient = new SVNWCClient(svnClientManager, options);
svnwcClient.doSetRevisionProperty(svnurl, SVNRevision.parse(revision.toString()), "svn:log", SVNPropertyValue.create(msg), false, null);
}
在此之前,需要在svn的仓库的hooks里添加一个pre-revprop-change.bat文件
内容如下:
SET REPOS="%1"
SET REV="%2"
SET USER="%3"
SET PROPNAME="%4"
SET ACTION="%5"
IF %ACTION% == "M" (IF %PROPNAME% == "svn:log" (EXIT 0))
ECHO "Changing revision properties %PROPNAME% is prohibited" >&2
EXIT 1
不需要进行修改,目的是允许对log进行再编辑