[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index


From: Gourlay, Colin <cg1_at_ebs.hw.ac.uk>
Date: Tue, 2 Sep 2008 11:02:56 +0100


I am attempting to create a hook (pre-commit) that will stop users from committing a specific version of Microsoft Word file.

Specifically looking to block Word version 2007 which happens to have a .docx file extension and force them to commit versions in older versions with a .doc version. This is to ensure that everyone can work with the documents - irrespective of the version they have installed on their desktop.

Subversion version 1.4.4 (r25188) is running on Windows 2003 server - so attempted to put something together with DOS batch files, also tried writing a c# console application - all following the templates as a guide and with partial success, in that I am only obtaining minimal information about the transaction not the file(s) being committed.

Can anyone please help?

Sample code (c#) that I have used follows:

          static int Main(string[] args)
            System.Diagnostics.Process p = new System.Diagnostics.Process();
            p.StartInfo.FileName = "svnlook";
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.Arguments = @" changed -t " + args[1] + @"D:\SubversionRepos\ProjectName";

            string output = p.StandardOutput.ReadToEnd();
            output = output.ToLower();

            System.IO.StreamWriter sw = new System.IO.StreamWriter(@"D:\PreCommit.txt", true, System.Text.Encoding.Default);
            sw.WriteLine(string.Join("|", args));
            sw.WriteLine("output = " + output);

                return 1;
            return 0;


Edinburgh Business School is a Charity Registered in Scotland, SC026900

To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-09-02 12:03:22 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.