So I know how to export files @ certain revisions to the filesystem (because all of the overloads for Export have paths in them) but I do not want to have to use the filesystem for ease of access purposes. Is there a way to redirect this to a string or something? Thanks.
Asked
Active
Viewed 1,666 times
2 Answers
9
You can use SvnClient.Write()
to do this.
Example:
using(var stream = new MemoryStream())
{
// export urlToFile, at revision 1234:
client.Write(new SvnUriTarget(new Uri(urlToFile), 1234), stream);
}

Sander Rijken
- 21,376
- 3
- 61
- 85
-
1Or just client.Write(new Uri(..), stream) if you want the HEAD revision. – Bert Huijben Aug 07 '10 at 13:39
0
I stand corrected, but cannot delete the post.
I took a look at the source code for SharpSVN, and it doesn't look promising. Instead of using .NET file streams for writing to the file system (which might have given us some insight how to use the .NET stream of our choice), the library does native interop when executing commands. The native methods return values indicating success or failure, but do not appear to provide handles to anything we can turn into a MemoryStream
or some such in-memory structure.
I think a least-effort solution to the problem is to export revisions to temporary file storage, then read the file(s) into memory with the System.IO
classes.

kbrimington
- 25,142
- 5
- 62
- 74
-
Nooooooooooooo :P Cannot store (even temporarily) on the filesystem I guess I will have to find another way! Thanks. – Sam F Aug 06 '10 at 20:04
-