rogermills
IS-IT--Management
Hi
I am new to perl so bear with me. I am writing a subversion hook script in perl. The script will check the log message at commit and get the issue ID (e.g. CNR12345) from the message, if the issue ID is not found in the log message it will block the commit else move on. The problem is it will reject the commit if it cannot find a Issue ID which works as expected. But when there is a Issue present still it is reject the commit. It should not reject the commit if the issue is there. The issue ID is like CNR12345 and start's at the beginning of the log message.
Thanks guys
Roger
I am new to perl so bear with me. I am writing a subversion hook script in perl. The script will check the log message at commit and get the issue ID (e.g. CNR12345) from the message, if the issue ID is not found in the log message it will block the commit else move on. The problem is it will reject the commit if it cannot find a Issue ID which works as expected. But when there is a Issue present still it is reject the commit. It should not reject the commit if the issue is there. The issue ID is like CNR12345 and start's at the beginning of the log message.
Thanks guys
Roger
Code:
#!D:\perl\bin\perl
use strict;
use warnings;
my ($txn_name, $repo_path) = @ARGV;
my $svnlook = "D:\\Subversion\\bin\\svnlook.exe";
my $committer = `$svnlook author $txn_name $repo_path` or die("Unable to get committer with svnlook.\n");
chomp($committer);
my $commitlog = `$svnlook log $txn_name $repo_path` or die("Unable to get log message with svnlook.\n");
my ($cnr_number) = $commitlog =~ /^CNR\d+/; or die("You must enter a valid CNR\n");