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

RE: Hooks

From: Giulio Troccoli <Giulio.Troccoli_at_uk.linedata.com>
Date: Tue, 2 Sep 2008 11:09:01 +0100

>

Linedata Services (UK) Ltd
Registered Office: Bishopsgate Court, 4-12 Norton Folgate, London, E1 6DB
Registered in England and Wales No 3027851 VAT Reg No 778499447

-----Original Message-----

> From: Gourlay, Colin [mailto:cg1_at_ebs.hw.ac.uk]
> Sent: 02 September 2008 11:03
> To: users_at_subversion.tigris.org
> Subject: Hooks [auto-ip]
>
> Hello.
>
> 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";
> p.Start();
> p.WaitForExit();
>
> 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);
> sw.Close();
>
> if(output.Contains("docx"))
> {
> return 1;
> }
> return 0;
>
> }

My repository is on Linux so I don't have direct experience, but I read many times on this mailing list that you should use a full path for all your programmes. Have you tried using

p.StartInfo.FileName = "C:\wherever\svn\has\been\installed\svnlook.exe";

or something like that?

Giulio

---------------------------------------------------------------------
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:09:37 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.