本文介绍了sharpsvn的LogMessage编辑sharpsvn?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用sharpsvn。
中的特定修订的LogMessage要更改



据实施像[显示日志] - '。SVN的



我的英语很尴尬。
这样,以帮助您了解。
我的代码附

 公共无效logEdit()
{
系列< SvnLogEventArgs> ; logitems =新的收集和LT; SvnLogEventArgs>();

SvnRevisionRange范围=新SvnRevisionRange(277,277);
SvnLogArgs ARG =新SvnLogArgs(范围);

m_svn.GetLog(新的System.Uri(m_targetPath),阿根廷,出logitems);

SvnLogEventArgs日志;
的foreach(在logitems VAR logentry)
{
串作者日期= logentry.LogMessage; //只读..
//作者日期+ =AA;
}

// m_svn.Log(新的System.Uri(m_targetPath),新System.EventHandler&所述; SvnLogEventArgs>());

}


解决方案

每个日志Subversion中的信息被存储为一个版本属性,即与每个版本的推移元数据。见href=\"http://svnbook.red-bean.com/en/1.7/svn.ref.properties.html\" rel=\"nofollow\">颠覆性质完整列表,此相关答案和颠覆的。相关答案表明你想要做的是一样的东西:

 的svn propedit -r 277 --revprop的svn:日志新日志信息<路径或URL> 

在一个标准库,因为默认行为是修订版本属性不能修改这会导致错误。请参阅有关如何改变这种不断变化的日志消息 的pre-revprop变化库钩



翻译到SharpSvn:

 公共无效ChangeLogMessage(URI repositoryRoot,长长的修订,串NewMessage作为)
{
使用(SvnClient客户端=新SvnClient())
{
SvnSetRevisionPropertyArgs SA =新SvnSetRevisionPropertyArgs();

//这里我们防止引发异常时,
//库没有更改日志消息
sa.AddExpectedError(SvnErrorCode.SVN_ERR_REPOS_DISABLED_FEATURE)的支持;

client.SetRevisionProperty(repositoryRoot,
版本,
SvnPropertyNames.SvnLog,
NewMessage作为,
SA);

如果(sa.LastException = NULL&放大器;!&安培;
sa.LastException.SvnErrorCode ==
SvnErrorCode.SVN_ERR_REPOS_DISABLED_FEATURE)
{
的MessageBox。展会(
sa.LastException.Message,

MessageBoxButtons.OK,
MessageBoxIcon.Information);

}
}
}


use the sharpsvn.The specific revision logmessage want to change.

It is implemented like '[show log] -[edit logmessage]' of svn.

I am awkward in English.so, to help you understand.my code is attached.

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

    }
解决方案

Every log message in Subversion is stored as a revision property, ie metadata that goes with each revision. See the complete list of subversion properties. Also have a look at this related answer and the Subversion FAQ. The related answer shows that what you want to do is something like:

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

On a standard repository this causes an error because the default behavior is that revision properties cannot be modified. See the FAQ entry about changing log messages on how to change that with a pre-revprop-change repository hook.

Translated to 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);

        }
    }
}

这篇关于sharpsvn的LogMessage编辑sharpsvn?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 21:26