如何获取 svn 日志消息
using (SvnClient client = new SvnClient())
{
client.Commit(_targetPath, commitArgs);
SvnInfoEventArgs result;
client.GetInfo(_targetPath, out result);
SvnLogArgs args = new SvnLogArgs();
args.Start = new SvnRevision(result.LastChangeRevision);
args.End = new SvnRevision(result.Revision);
Collection<SvnLogEventArgs> logitems;
client.GetLog(_targetPath, args, out logitems);
foreach (SvnLogEventArgs logentry in logitems)
{
string author = logentry.Author;
string message = logentry.LogMessage;
DateTime checkindate = logentry.Time;
AddMessage(string.Format("Commited successfully by {0} on {1} for message: {2}", author, checkindate, message));
}
}
这是我的代码,但我只能得到一个日志项,它应该是修订范围内所有日志的路径,有什么问题吗?
using (SvnClient client = new SvnClient())
{
client.Commit(_targetPath, commitArgs);
SvnInfoEventArgs result;
client.GetInfo(_targetPath, out result);
SvnLogArgs args = new SvnLogArgs();
args.Start = new SvnRevision(result.LastChangeRevision);
args.End = new SvnRevision(result.Revision);
Collection<SvnLogEventArgs> logitems;
client.GetLog(_targetPath, args, out logitems);
foreach (SvnLogEventArgs logentry in logitems)
{
string author = logentry.Author;
string message = logentry.LogMessage;
DateTime checkindate = logentry.Time;
AddMessage(string.Format("Commited successfully by {0} on {1} for message: {2}", author, checkindate, message));
}
}
This is my codes, but I only can get one logentry,it should be the path all logs for the revision range,what's the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我对此 api 一无所知,但看起来您正在调用 GetLog,其范围介于上次更改修订版和当前修订版之间。本能地,我认为根据定义这只是一个日志条目。
所以我的想法是你的修订范围是错误的。为什么不尝试对预期的修订范围进行硬编码并查看结果是否符合您的预期。
I don't know anything about this api but it looks like you are calling GetLog with a range between the last change revision and the current revision. Instinctually, I would think this would only be a single log entry by definition.
So my thought is that your revision range is wrong. Why don't you try hard coding the expected revision range and seeing if the results meets your expectations.
我认为您想要做的是在提交工作副本时列出已更改的文件,即在提交文件时显示文件通知。有一种比您正在做的更好的方法:
请参阅
Notify
事件,以及SvnNotifyEventArgs
了解更多详情。此外,您还可以使用
Commit
重载具有SvnCommitResult
out 参数>:I think what you're trying to do is list changed files as you're committing a working copy, ie show notifications of files as they're committed. There's a much better way to do this than what you're doing:
See the
Notify
event, andSvnNotifyEventArgs
for more details.In addition, you can also use a
Commit
overload that has anout
parameter of typeSvnCommitResult
:好吧,现在我从下面的代码中得到了我想要的:
okay now i've got what i want from below codes: