Implementing faster svn cat with SvnClient

I am looking for a faster way to extract files from SVN than svn cat in .NET.

I am currently running the svn cat process for each revision, but it is very slow.

Then I tried with SvnClient:

Stream st = Console.OpenStandardOutput(); SvnWriteArgs wargs = new SvnWriteArgs(); for (int i = 3140; i < 3155; ++i) { wargs.Revision = i; client.Write(new SvnUriTarget("http://filezilla.svn.sourceforge.net/svnroot/filezilla/FileZilla3/trunk/README"), st, wargs); } st.Flush(); 

But each iteration is even slower than svn cat.

Is there a way in SvnClient to β€œreuse” a previously opened connection to the SVN server so that the operation with several cats can be faster?

+3
source share
1 answer

You can use the FileVersions command to do this. This allows you to get one complete file and all other files, using the differences between each revision in the same connection. This should give a good performance boost.

 public void WriteRevisions(SvnTarget target, SvnRevision from, SvnRevision to) { using(SvnClient client = new SvnClient()) { SvnFileVersionsArgs ea = new SvnFileVersionsArgs { Start = from, End = to }; client.FileVersions(target, ea, delegate(object sender2, SvnFileVersionEventArgs e) { Debug.WriteLine(e.Revision); e2.WriteTo(...); }); } } 

This requires a server that supports this feature. I'm not quite sure when this was introduced, but Codeplex running SvnBridge, for example, does not support it. If I remember correctly, the delegate is called only once in this case, in which case you will have to return to the first solution. Under normal circumstances, a delegate is called for each revision between Start and End.

See the WalkMe (and others) method in this test file to learn more about its use (username, password).

+4
source

Source: https://habr.com/ru/post/917208/


All Articles