1

My hook post-commit template calls my postcommitlog.exe to create a MyFile_LOG.txt and write to it the 3 arguments. The repository and the transaction is passed from the postcommit template.

The problem is that, after committing a file in TurtoiseSVN, there is no log created. It looks like either I do not have the permission to create a file on the repository or there is an error in my code.

My code works locally, when I Debug it and pass random arguments to it, a log file is created on my local machine. But its not working on the SVN hook.

THE TEMPLATE

\\myserver\e$\Repositories\CONRAD\hooks\postcommitlog.exe %1 %2

MY PROGRAM

using System;
using System.IO;

namespace postcommitlog
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            string repositories = args[0];
            string transaction = args[1];

            const string LOG_PATH = @"\\myserver\e$\Repositories\CONRAD\hooks\MyFile_LOG.txt";

            FileInfo fileInfo = new FileInfo(LOG_PATH);

            File.AppendAllText(LOG_PATH, "Repositories " + args[0]
                + "\t Transaction " + args[1] + "\t Date " + DateTime.Now.ToString("MMM ddd d HH:mm yyyy") + Environment.NewLine);
        }
    }
}
Conrad C
  • 746
  • 1
  • 11
  • 32

1 Answers1

1

The mistake was that I was supposed to create a BAT file from the template, not use the template. The template does nothing, it is what it is : a template. The BAT file is run by SVN then runs the script.

More info here:

http://svnbook.red-bean.com/en/1.5/svn.reposadmin.create.html#svn.reposadmin.create.hooks

Conrad C
  • 746
  • 1
  • 11
  • 32