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
Received on 2008-03-17 22:55:18 CET