问题
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> ());
}
回答1:
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);
}
}
}
回答2:
As far as I am aware, SharpSvn (as well as SVN clients generally) provides mainly read-only access, and will not allow you to edit the log message on the repository. However, if you have admin access and need to edit a log message you can possibly do it yourself.
来源:https://stackoverflow.com/questions/16292387/sharpsvn-logmessage-edit-sharpsvn