代码
using (var svnClient = new SvnClient())
{
Collection<SvnLogEventArgs> svnLogEntries;
svnClient.GetLog(new Uri("https://DbDiff.svn.codeplex.com/svn"), out svnLogEntries);
foreach (var svnLogEntry in svnLogEntries)
{
foreach (var changedPath in svnLogEntry.ChangedPaths)
{
Debug.WriteLine("NodeKind: " + changedPath.NodeKind + ", Path: " + changedPath.Path);
}
}
}
输出
NodeKind: Unknown, Path: /DbDiffCommon/DataAccess/SqlCommand11.xml
NodeKind: Unknown, Path: /DbDiffCommon/DataAccess/SqlCommand9.xml
NodeKind: Unknown, Path: /DbDiffCommon/DataAccess/SqlCommand11.xml
NodeKind: Unknown, Path: /DbDiffCommon/DataAccess/SqlCommand7.xml
NodeKind: Unknown, Path: /DbDiffCommon/DataAccess/SqlCommand8.xml
NodeKind: Unknown, Path: /DbDiffCommon/DataAccess/SqlCommand9.xml
NodeKind: Unknown, Path: /DbDiffCommon/Model/DatabaseConnectString.cs
NodeKind: Unknown, Path: /DbDiffCommon/Helper/Enums.cs
NodeKind: Unknown, Path: /DbDiffWinClient/Forms/frmRegisterServer.resx
NodeKind: Unknown, Path: /DbDiffWinClient/Forms/frmConnectDb.resx
NodeKind: Unknown, Path: /DbDiffWinClient/Forms/frmRegisterServer.cs
NodeKind: Unknown, Path: /DbDiffWinClient/Forms/frmConnectDb.cs
NodeKind: Unknown, Path: /DbDiffCommon/Model/RegisteredServer.cs
NodeKind: Unknown, Path: /DbDiffWinClient/ChangeLog.txt
NodeKind: Unknown, Path: /DbDiffWinClient/Forms/DbItems/ucTableDiffInfo.cs
NodeKind: Unknown, Path: /DbDiffCommon/DataAccess/DatabaseDataSets.cs
...
为什么changedPath.NodeKind
总是“未知”?我希望它是上面输出的“文件”..
答案 0 :(得分:2)
并非所有服务器都发送nodeKind用于&#34; log&#34;请求。看到这个讨论: http://old.nabble.com/SVNNodeKind-%3D-UNKNOWN-td34018265.html#a34018265
答案 1 :(得分:1)
看起来我可以使用SvnClient.GetInfo获取正确的NodeKind,但是为每个更改的路径调用它都非常慢..
using (var svnClient = new SvnClient())
{
Collection<SvnLogEventArgs> svnLogEntries;
string repoUri = "https://DbDiff.svn.codeplex.com/svn";
svnClient.GetLog(new Uri(repoUri), out svnLogEntries);
foreach (var svnLogEntry in svnLogEntries)
{
foreach (var changedPath in svnLogEntry.ChangedPaths)
{
SvnInfoEventArgs svnInfo;
svnClient.GetInfo(new SvnUriTarget(repoUri + changedPath.Path, svnLogEntry.Revision), out svnInfo);
Debug.WriteLine("NodeKind: " + svnInfo.NodeKind + ", Path: " + changedPath.Path);
}
}
}