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.
views:
322answers:
2
A:
You want the GetLog method.
SvnRevision rev(123);
client.GetLog(uri, new SvnLogArgs(rev), out logitems); // uri is your url to the repo.
That might not be exact (no intellisense! how am I expected to code C# without that :( ), but its roughly what you want.
gbjbaanb
2009-08-08 13:52:48
Doesn't work for hooks
Sander Rijken
2010-10-22 18:37:34
+2
A:
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)
{
//
}
}
}
Bert Huijben
2009-08-09 21:25:17