使用sharpsvn。要更改的特定修订日志消息。
实现方式类似svn的show log -edit logmessage。
我的英语很笨拙。所以,为了帮助你理解。我的代码在附件中。
public void logEdit()
{
Collection<SvnLogEventArgs> logitems = new Collection<SvnLogEventArgs>();
SvnRevisionRange range = new SvnRevisionRange(277, 277);
SvnLogArgs arg = new SvnLogArgs( range ) ;
m_svn.GetLog(new System.Uri(m_targetPath), arg, out logitems);
SvnLogEventArgs logs;
foreach (var logentry in logitems)
{
string autor = logentry.LogMessage; // only read ..
// autor += "AA";
}
// m_svn.Log( new System.Uri(m_targetPath), new System.EventHandler<SvnLogEventArgs> ());
}发布于 2013-05-15 02:05:07
Subversion中的每条日志消息都存储为修订属性,即每个修订附带的元数据。请参阅complete list of subversion properties。还可以看看this related answer和Subversion FAQ。相关答案表明,您想要做的事情如下:
svn propedit -r 277 --revprop svn:log "new log message" <path or url>在标准存储库上,这会导致错误,因为默认行为是不能修改修订属性。有关如何使用pre-revprop-change存储库挂钩更改日志消息的信息,请参阅FAQ entry。
翻译成SharpSvn:
public void ChangeLogMessage(Uri repositoryRoot, long revision, string newMessage)
{
using (SvnClient client = new SvnClient())
{
SvnSetRevisionPropertyArgs sa = new SvnSetRevisionPropertyArgs();
// Here we prevent an exception from being thrown when the
// repository doesn't have support for changing log messages
sa.AddExpectedError(SvnErrorCode.SVN_ERR_REPOS_DISABLED_FEATURE);
client.SetRevisionProperty(repositoryRoot,
revision,
SvnPropertyNames.SvnLog,
newMessage,
sa);
if (sa.LastException != null &&
sa.LastException.SvnErrorCode ==
SvnErrorCode.SVN_ERR_REPOS_DISABLED_FEATURE)
{
MessageBox.Show(
sa.LastException.Message,
"",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
}
}发布于 2013-05-01 20:48:57
据我所知,SharpSvn (以及一般的SVN客户端)主要提供只读访问,不允许您在存储库上编辑日志消息。但是,如果您拥有管理员访问权限并需要编辑日志消息,则可以使用do it yourself。
https://stackoverflow.com/questions/16292387
复制相似问题