I am trying to find source of integration from one of my opened file on my perforce client.
My command :-
/grid/common/pkgs/perforce/v2018.1/bin/p4 -p 10.202.176.19:1641 -Ztag -F %clientFile% opened -c default -C cheruvu_client | /grid/common/pkgs/perforce/v2018.1/bin/p4 -p 10.202.176.19:1641 -F %fromFile% -x - resolved
Command working as expected when i run it explicitly.
But when i try to run in my script it's not working as expected.
My script :-
use strict;
use warnings;
my $Client = $ARGV[0];
my $ChangeNum = $ARGV[1];
my $Port = $ARGV[2];
my $p4 = "/grid/common/pkgs/perforce/v2018.1/bin/p4 -p $Port";
my @files = `$p4 -Ztag -F %clientFile% opened -c $ChangeNum -C $Client | $p4 -F %fromFile% -x - resolved`;
if (@files){
foreach my $file(@files){
chomp($file);
if ($file =~ /\/\/depot\/vip\/src\/branches\/private_branch\/.*/i){
print "Integrations from private_branch-> main is not allowed.\n\n";
exit(1);
}
}
}
@files array value is empty. Though i have opened file for integrate.
Purpose my script is to setup a trigger to avoid integrations from private_branch to main branch. Not sure is something is wrong in my command mentioned in script.
Run time arguments to script is passed while submitting file. There is no issue in run time argument parsing.
Please help.