我正在尝试使用 SharpSvn 来获取特定版本的文件内容。我有以下代码:
var svnClient = new SvnClient();
var revisionInfo = new SvnFileVersionsArgs
{
Start = 80088,
End = 80093
};
Collection<SvnFileVersionEventArgs> fileVersions;
svnClient.GetFileVersions(
new SvnUriTarget("https://DbDiff.svn.codeplex.com/svn/DbDiffCommon/DataAccess/SqlCommand11.xml"),
revisionInfo,
out fileVersions);
var stream = fileVersions[0].GetContentStream();
但是在最后一行我得到以下异常:
System.InvalidOperationException was unhandled
Message=This method can only be invoked from the eventhandler handling this eventargs instance
Source=SharpSvn
StackTrace:
at SharpSvn.SvnFileVersionEventArgs.GetContentStream(SvnFileVersionWriteArgs args) in g:\dist\src\sharpsvn\commands\fileversions.cpp:line 545
at SharpSvn.SvnFileVersionEventArgs.GetContentStream() in g:\dist\src\sharpsvn\commands\fileversions.cpp:line 534
at SharpSvnFileVersions.Program.Main(String[] args) in c:\temp\SharpSvnFileVersions\Program.cs:line 29
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
我应该如何在每次修订时获取文件的内容?