0

I'm writing a small console tool in C# that needs to know the revision number of an SVN working copy directory to process other data with this number. I already have support for SVN 1.4 to 1.6 by directly reading the entries file in all .svn directories. But SVN 1.7 has changed that to use a single .svn directory with an SQLite database in it.

What's the best method to determine the revision number of a working directory?

I've just tried to use SharpSVN, but it's largely undocumented and I can't figure out how to use it. It's also very huge with 5 MB and potentially several DLLs.

I can't find a simple SVN command line client that is freely downloadable. Also, last time I've seen one, it was huge and consisted of numerous files which is not exactly portable. (It would be great if my tool would only come as a single .exe file.)

Another option would be to use an SQLite library (available as a single separate DLL) and dig into the database myself. I've already done basic research on this but I'm not sure how to detect uncommitted modifications.

TortoiseSVN, which is likely already installed on the machines that will be using my tool, can't be used because it contains everything in a single GUI application, no DLLs that I could reuse.

1
  • Check the page for a command-line tools: visualsvn.com/downloads Commented Apr 11, 2013 at 13:57

2 Answers 2

1

If you don't want SharpSVN and work with Working Copy, then in 99% host may have SVN CLI-tools.

Check callability of svnversion and call it svnversion <PATH-TO-WC>, intercept output

Sign up to request clarification or add additional context in comments.

2 Comments

Until today, I was using TortoiseSVN and Ankh alone, and there was no SVN CLI on my computer. But I've noticed that there is a setup option to include CLI binaries with TortoiseSVN 1.7, so I may just stick with that and use the CLI from there. That would be an easy setup process. So you two suggest using an external CLI tool is the best way, right?
@LonelyPixel - not the best, from my POV (external dependences, which you can't resolve), but easiest
1

I use Tortoise SVN's command line tool called 'SubWCRev' for this purpose (http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-subwcrev.html). It allows to determine latest revisions, commit date and more... The drawback of this solution is that this tool work with files, so you will need to define template file and parse tool's output file. This works good for me though.

1 Comment

Without template and destination files SubWCRev output to stdout

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.