I am by no means an expert. We do also have a pre-commit hook that prints to standard error via a perl script. It prints fine to the Tortoise commit screen.
The only different I see is that our script uses different printing -
it's like this, but i think it should be the same thing. the select appears at the top and then you just use print.
select(STDERR);
print "the string";
Sorry I can't help more. I am sure someone will be much more helpful than I.
KM
DePriest Richard 403 <richard.depriest_at_crackerbarrel.com> wrote:
We are starting to use subversion with tortoise. There is a pre-commit hook that fires and calls a perl script that checks to see if a file is locked and if it is not it will error out and not allow the commit. The error is getting written to STDERR and we cannot see it through tortoise. Is there anyway to see the error in tortoise? I am including the hook and the perl program.
hook:
@ECHO OFF
REM Set command line client language to english
set LC_ALL=C
set SVNLOOK="/usr/bin/svnlook"
set REPOS=%1
set TXN=%2
cd /u01/svn/repositories/Crackerbarrel/hooks
perl checklock_nopropcheck.pl %SVNLOOK% %REPOS% %TXN%
exit %ERRORLEVEL%
perl:
$SVNLOOK = $ARGV[0];
$REPOS = $ARGV[1];
$TXN = $ARGV[2];
sub main {
#Get Author
open(AUTHOR,"\"$SVNLOOK\" author -t $TXN \"$REPOS\" |");
$Author = (<AUTHOR> =~ /(\w+\b)/)[0];
close(AUTHOR);
# Get changed files
open(CHANGED,"\"$SVNLOOK\" changed -t $TXN \"$REPOS\" |");
@ChangedFiles = <CHANGED>;
close(CHANGED);
print @ChangedFiles;
foreach $File (@ChangedFiles){
if($File =~ /^[UD]/){ #Only updated and deleted
if($File !~ /(.*)\/\s*$/){ #Is not a directory
$File = ($File =~ /....(.*)[\n\b]/)[0]; #Get just the file name
open(LOCKDATA,"\"$SVNLOOK\" lock \"$REPOS\" \"$File\" |");
$Lockdata = join("",<LOCKDATA>);
close(LOCKDATA);
if($Lockdata =~ /Owner: (\w+\b)/){
return $1
} else {
print STDERR "Lock Error: There is a modified file without lock!($File)\n";
exit 1
}
}
}
}
}
main();
exit 0;
Any help will be very much appreciated.
Rick DePriest
Project Manager - Retail Systems
Cracker Barrel Old Country Stores, Inc.
Ph. (615) 443-9845
Email: rdepries_at_crackerbarrel.com
---------------------------------
Never miss a thing. Make Yahoo your homepage.
Received on 2008-03-18 15:08:09 CET