tags:

views:

262

answers:

1

Say i have a svn repository at https://www.mysvn.com/svn/. How can i use SharpSVN to figure out whether the remote folder https://www.mysvn.com/svn/a/b/c exists on the server?

I need to do it an a way that allows me to tell the difference between a failed connection (ie server down) and the folder simply not having been created yet.

Calling info on the full https://www.mysvn.com/svn/a/b/c path does not seem to give an exception that enables me to tell the difference between no repository at all and just a missing folder.

I could list all files for https://www.mysvn.com/svn/ but the repository can easily be so big that this can take too long.

Right now im doing an info on first the root url and then on the full url. If the root url fails i treat it as a server problem, but if it succeeds and the full url fails i assume its because part of the path hasnt been created on the server. This could however give the wrong answer if the internet connection was lost between the two checks or similar.

+1  A: 

Wouldn't svn list https://www.mysvn.com/svn/a/b/c (or rather, its equivalent binding) do it? It should return something different if the path isn't found. For example, the command line client returns

svn: URL 'https://www.mysvn.com/svn/a/b/c' non-existent in that revision
Michael Hackner
Im currently testing with local filesystem repositories (ie the url is "file:///<somepath>"), and in this case SharpSvn.SvnClient.List gives me a "SharpSvn.SvnRepositoryIOException: Unable to open an ra_local session to URL"when i feed it the url of the repository appended with a bogus relative path. Exactly the same exception is thrown when giving a completely bogus url.
Ziphnor