题
我使用 SharpSvn 以交互通过C#代码我的svn库。我使用此代码SVN检索日志条目:
Collection<SvnLogEventArgs> logitems;
var uri = new Uri("http://myserver/svn/foo/bar.txt");
client.GetLog(uri, out logitems);
foreach (var logentry in logitems)
{
string author = logentry.Author;
string message = logentry.LogMessage;
DateTime checkindate = logentry.Time;
}
这工作得很好,但现在我想限制由修订日期返回的日志条目。这一点是可以通过svn命令行完成的东西,如
svn log "http://myserver/svn/foo/bar.txt" --revision {2008-01-01}:{2008-12-31}
我似乎无法找出内SharpSvn并联能力。有人能指出我朝着正确的方向吗?
解决方案
您可以尝试一下这样的:
DateTime startDateTime = // ...;
DateTime endDateTime = // ...;
SvnRevisionRange range = new SvnRevisionRange(new SvnRevision(startDateTime), new SvnRevision(endDateTime));
client.GetLog(uri, new SvnLogArgs(range), out logitems);
其他提示
我的认为的你也许可以使用GetLog
功能,需要一个SharpSvn.SvnLogArgs
参数的一个做到这一点。
public bool GetLog(System.Uri target, SharpSvn.SvnLogArgs args,
out System.Collections.ObjectModel.Collection logItems)
这类有Start
/ End
是其中 SharpSvn.SvnRevision
对象看起来像他们可以采取 “时间” 参数。
我只是做了它一点点,但是这将是在那里你可以开始寻找。
不隶属于 StackOverflow