[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: David Weintraub <qazwart_at_gmail.com>
Date: Mon, 23 Mar 2009 11:30:35 -0400

The problem is the fact that Windows insists on using "C:/Program
Files" as a place where it puts all commands. The space in Program
Files causes problems with many programs because most programs use
spaces for separating command line parameters. It is the bane of my
existence on Windows systems. One of the joys that Vista brought is
moving this to a C:

You must either change SVN_LOOK on line #39 or use:

pre-commit-access-control-hook -svnlook 'C:/Program Files/Subversion/svnlook'

when you call my hook script in the pre-commit.bat file (Note the
single quotes around the entire path to the svnlook command).

Also try putting the the following lines around line #552 of my
program and see what this does:

print "DEBUG: Checking for author\n";
chomp ($author = qx($svnlookCmd author $option $repository));
print "DEBUG: Author = $author\n";

(The "chomp" line is line #552) This will give you an additional
error message. If you get the following:

DEBUG: Checking for author
'C:/Program' is not recognized as an internal or external
command,operable program or batch file."

Then, I know it is this line that is causing problems. If you don't
get that far, it is likely the problem is in the pre-commit.bat
trigger script.

On Sun, Mar 22, 2009 at 10:40 AM, Tsahi Asher <tsahi_75_at_yahoo.com> wrote:
> alright, checking for
>
> if errorlevel 1...
>
> instead of
>
> if not errorlevel 0...
>
> detected an error, but i still get the
>
>
> "'C:/Program' is not recognized as an internal or external command,operable
> program or batch file."
>
> error.
>
> 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: David Weintraub <qazwart_at_gmail.com>
>> To: Tsahi Asher <tsahi_75_at_yahoo.com>
>> Cc: users_at_subversion.tigris.org
>> Sent: Thursday, March 19, 2009 4:42:06 PM
>> Subject: Re: EOL Check Hook Script?
>>
>> Yes it does. The STDERR contains a list of why the hook fails, so this
>> is returned to the user.
>>
>> On Thu, Mar 19, 2009 at 10:35 AM, Tsahi Asher wrote:
>> >
>> > Thanks for the answer. I already have a pre-commit.bat file, which runs pretty
>> good so fare, except for detecting that property on replaced files.
>> >
>> > What about the second issue? Does your script exit with a non-zero exit code
>> when one of the rules is not met?
>> >
>> > 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: David Weintraub
>> >> To: Tsahi Asher
>> >> Cc: users_at_subversion.tigris.org
>> >> Sent: Thursday, March 19, 2009 4:25:38 PM
>> >> Subject: Re: EOL Check Hook Script?
>> >>
>> >> The problem is that I am not that familiar with Windows or the Batch
>> >> programming language. I also don't have access to a Windows system in
>> >> order to do some testing.
>> >>
>> >> However, when you create a Subversion repository, there's a file
>> >> called pre-commit.bat.tmpl (or something like that) that's created.
>> >> You can use this as a template on how to create the pre-commit.bat
>> >> trigger file you need. That's what I did with the pre-commit shell
>> >> script that was created.
>> >>
>> >> I can't even find the pre-commit.bat.tmpl file in the repository.
>> >>
>> >> On Sun, Mar 15, 2009 at 5:39 AM, Tsahi Asher wrote:
>> >> >
>> >> > 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
>> >> >> 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:
>> >> >> >
>> >> >>
>> >> >> Cool stuff.  Thanks for sharing!
>> >> >>
>> >> >> Bob
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> --
>> >> David Weintraub
>> >> qazwart_at_gmail.com
>> >
>> >
>> >
>> >
>> >
>>
>>
>>
>> --
>> --
>> David Weintraub
>> qazwart_at_gmail.com
>>
>> ------------------------------------------------------
>> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1355764
>>
>> To unsubscribe from this discussion, e-mail:
>> [users-unsubscribe_at_subversion.tigris.org].
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1381410
>
> To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
>

-- 
--
David Weintraub
qazwart_at_gmail.com
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1390436
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-03-23 16:38:15 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.