I'm trying to write a post-commit hook using SharpSVN but can't figure out how to get the changeset info using SharpSVN given the revision number and the path to the repo. Any ideas are much appreciated.
In hook clients you most likely want to use the SvnLookClient that directly accesses the repository. In this example (copied from another question here) I also use the SvnHookArguments class for parsing the hook arguments.
static void Main(string[] args)
{
SvnHookArguments ha;
if (!SvnHookArguments.ParseHookArguments(args, SvnHookType.PostCommit, false, out ha))
{
Console.Error.WriteLine("Invalid arguments");
Environment.Exit(1);
}
using (SvnLookClient cl = new SvnLookClient())
{
SvnChangeInfoEventArgs ci;
cl.GetChangeInfo(ha.LookOrigin, out ci);
// ci contains information on the commit e.g.
Console.WriteLine(ci.LogMessage); // Has log message
foreach(SvnChangeItem i in ci.ChangedPaths)
{
//
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With