I want to add information to assembly on build if the working copy is modified (with exception to from ignore-on-commit changeset), but I'm afraid checking all changes using SharpSVN might slow down the build in a 100MB working copy with 1000+ files. Hence - what is a quickest way to get only the information that there are uncommited and/or unstaged changes?
If you just need the result: modified vs unmodified you could do something like this C# code:
// using SharpSvn;
bool foundModification = false;
using (SvnClient client = new SvnClient()
{
client.Status(@"C:\my\working\copy",
delegate(object sender, SvnStatusEventArgs e)
{
foundModification = true;
e.Cancel = true;
});
}
This does +- the absolute minimum required to find if there are actual changes in your working copy and stops the moment it found the first result.
SubWCRev and svnversion use a similar approach, but do some additional checks inside wc.db (assuming Subversion 1.7 or newer).
You probably want to extend the delegate a bit to skip some kinds of changes. (The Changelist is available as a property on the SvnStatusEventArgs object)