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

Re: EOL Check Hook Script?

From: Tsahi Asher <tsahi_75_at_yahoo.com>
Date: Sun, 15 Mar 2009 02:39:36 -0700 (PDT)

this accidentally almost solved my problem too. i need to enforce svn:needs-lock on .resx files. trying to run this on windows, though, has some side effects.
1. the -svnlook parameter may receive a value with spaces in it, e.g. "C:/Program Files (x86)/Subversion/bin/svnlook". the script seems to be unaware of this, and as a result, i get a

"'C:/Program' is not recognized as an internal or external command,operable program or batch file.
The system cannot find the path specified.
The system cannot find the path specified.

error. the path to svnlook should be sorrounded with quotes or something.

2. the example pre-commit file in the zip has this after the call to the script:

exit $?

what does it mean? i tried to replace it with

if not errorlevel 0 exit /b 1

but it didn't exit the hook script, and continued to run another script the pre-commit hook runs. what is the exit code your script uses when there is a rule violation?

 
i'd be happy if you could fix those problems.

here's my entire pre-commit.bat, translated to windows syntax:

set REPOS=%1
set TXN=%2

set CWD=%REPOS%/hooks
set SVNLOOK="C:/Program Files (x86)/Subversion/bin/svnlook"

set ACCESS_HOOK=%CWD%/pre-commit-access-control-hook.pl
set CONTROL_FILE=%CWD%/control-file.ini

rem PRE-COMMIT HOOK

C:\Perl\bin\perl %ACCESS_HOOK% -svnlook %SVNLOOK% -file %CONTROL_FILE% -t %TXN% %REPOS%

if not errorlevel 0 (
  echo Goto TortoiseSVN settings ^> Edit button, add the following line to [auto-props]: >&2
  echo *.resx = svn:needs-lock >&2
  echo and make sure you set >&2
  echo enable-auto-props = yes >&2
  exit /b 1
)

and then it calls some other script, which is run even if the pre-commit-acces-control-hook fails. i do get the error message, e.g.

 ERROR: Commit failed for the following reasons:
 Property "svn:needs-lock" needed for file "Fantasy.NET/trunk/Fantasy.Presentation/AboutBoxForm.resx".
         Must match string '*'.

but the commit doesn't stop.

thanks,
tsahi

--
The day Micro$oft sells something that doesn't SUCK
is the day they start selling vacuum cleaners.
http://www.geocities.com/tsahi_75
----- Original Message ----
> From: Bob Proulx <bob_at_proulx.com>
> To: users_at_subversion.tigris.org
> Sent: Friday, March 13, 2009 9:30:40 AM
> Subject: Re: EOL Check Hook Script?
> 
> David Weintraub wrote:
> > ou can download the hook script here:
> > <http://dl.getdropbox.com/u/433257/hooks.zip>
> 
> Cool stuff.  Thanks for sharing!
> 
> Bob
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1326120
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-03-15 10:40:30 CET

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.