3

使用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> ());

    }
4

2 回答 2

2

Subversion 中的每条日志消息都存储为一个修订属性,即每个修订附带的元数据。请参阅颠覆属性的完整列表。另请查看此相关答案和 Subversion FAQ。相关答案表明您想要做的是:

svn propedit -r 277 --revprop svn:log "new log message" <path or url>

在标准存储库上,这会导致错误,因为默认行为是无法修改修订属性。请参阅关于如何使用存储库挂钩更改日志消息的常见问题解答条目。pre-revprop-change

翻译成 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-14T18:05:06.893 回答
0

据我所知,SharpSvn(以及一般的 SVN 客户端)主要提供只读访问权限,并且不允许您编辑存储库上的日志消息。但是,如果您有管理员权限并且需要编辑日志消息,您可以自己进行。

于 2013-05-01T12:48:57.340 回答