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

Re: Noob question on pre-commit windows script

From: Simon Large <simon.tortoisesvn_at_googlemail.com>
Date: Thu, 7 Feb 2008 23:13:47 +0000

On 07/02/2008, Stefan Küng <tortoisesvn_at_gmail.com> wrote:
> Tom Blough wrote:
>
> > I understand the above and downloaded TortoiseSVN 1.4.99.12031 which appears
> > to have client side hook scripts. However, I'm still having problems
> > getting a hook to run. I though maybe spaces in the working path might be
> > causing problems, so I checked out my project to c:\temp and created a hook
> > script in TortoiseSVN:
> >
> > Post_commit_hook
> > Path: C:\temp
> > Command line: C:\temp\version.bat
>
> Change that to
> cmd.exe /c "C:\temp\version.bat"
>
> > Wait: true
> > Hide: false
> >
> >
> >> Simon Large wrote:
> >>
> >> Also, I believe the syntax of your batch file is wrong. Try
> >> 'if exist' instead of 'if exists'.
> >
> > Excellent catch. To make sure I was not having any more stupid problems
> > with paths or anything else, I reduced my batch file in the working
> > directory to a single line:
> >
> > Type rtb.mkr > rtb.mkr
> >
> > This should create a zero length file in whatever directory the bat file is
> > executed. After the script runs, I should be able to search the disk for
> > rtb.mkr and discover what was the actual working path. Double-clicking the
> > bat file does indeed create a rtb.mkr file in the directory containing the
> > bat file.

If you want to create a zero length file you can use
type nul > rtb.mkr

> Small correction:
> Type rtb.mkr > rtb.mkr
> will not create a zero length file. If 'rtb.mkr' does not exist, the
> Type command will throw an error. And if it exists, the new file will
> contain the same as the rtb.mkr file.
>
> To create test files, use
> echo test > rtb.mkr
> instead.
>
> > The documentation on client-side hook scripts in 1.4.99.12031 has and
> > example screen print showing a script called
> > "C:\TortoiseSVN\Hooks\post-commit.bat", and I followed the instructions
> > exactly on creating a script, but still no joy in Mudville.
> >
> > Can someone who has gotten client-side hook scripts working comment on what
> > I am doing wrong?
>
> Yes, sorry. Those screenshots are wrong.
> Simon?

At least on my system I don't need to specify cmd.exe; a batch file
runs just fine for me. The hook settings shown in the docs are a
snapshot of one I have actually tried.

On another issue, I don't get any output into the command window.
Using this sample script:
@echo off
echo hello Simon
dir c:\
pause

I get a blank box flash up and disappear immediately. If I change the
3rd line to dir/s the box stays up for as long as the dir takes, but
there is still no output. Pause doesn't work, but maybe that's to be
expected as we're not expecting the hook to require user input.

Simon

-- 
       ___
  oo  // \\      "De Chelonian Mobile"
 (_,\/ \_/ \     TortoiseSVN
   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
   /_/   \_\     http://tortoisesvn.net
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_tortoisesvn.tigris.org
For additional commands, e-mail: users-help_at_tortoisesvn.tigris.org
Received on 2008-02-08 00:14:00 CET

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