Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get log details for a specific revision number in a post-commit hook with SharpSVN?

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.

like image 810
russcollier Avatar asked Nov 05 '22 20:11

russcollier


1 Answers

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)
    {
       //
    }
  }
}
like image 145
Bert Huijben Avatar answered Nov 13 '22 22:11

Bert Huijben