在变更列表范围之间进行整合
p4-64集成-c default $ branch1 \ @ $ chglist,\ @ $ chglist $ branch2> changes.txt
请更正剧本如果错误的地方......请指导我
#!/usr/local/bin/perl
#use Mail::Sender;
if ($#ARGV < 2 )
{
printf "please enter source branch, target branch and changelistrange(eg: @10001,@100005)\n";
exit 0;
}
$branch1=$ARGV[0];
$branch2=$ARGV[1];
@branch_name=("$branch1", "$branch2");
$chglistrange=$ARGV[2];
print $P4CLIENT;
system "(p4-64 info)" ;
#system "(p4-64 sync $branch1 )";
#system "(p4-64 sync $branch2 )";
sub verify_branches
{
foreach(@branch_name)
{
print "You passed in branch $_\n";
@array=`p4-64 branches -t -e $_`;
print "@array\n";
}
}
verify_branches
printf "start integration\n";
system ("p4-64 integ -v $branch1@$chglistrange $branch2 > changes.txt");
system ("p4-64 resolve -as > files.txt");
system ("p4-64 resolve -am > acceptmerge.txt");
system ("p4-64 resolve -n > output.txt");
if( -z output.txt )
{
printf "perforce submit";
#system ("p4-64 submit");
}
else
{
printf "perforce submit and sending an mail to developer for resolve conflicts";
#system ("p4-64 submit");
printf "write an email to developers\n";
$sender = new Mail::sender {
smtp => 'mail.yourdomain.com', from => ' '};
$sender->MailFile({to => 'somemail',
subject => 'Here are the conflicts in files to be resolved',
msg => "I'm sending the list of files which have conflicts.",
file => 'output.txt'});
这里我们尝试使用更改列表编号进行集成并解决冲突,并在文件中仍存在冲突时向用户发送邮件。
答案 0 :(得分:1)
p4 integrate $branch1\@$chglist1,\@chglist2 $branch2 > files.txt
确保$ branch1和$ branch2是映射分支中所有文件的路径,例如&#34; //仓库/主/... 34;和&#34; // depot / dev /..."而不是&#34; // depot / main&#34;和&#34; // depot / dev&#34;。如果它们未以该表单提供给您的脚本,则在将脚本传递给Perforce命令之前,您的脚本应附加必要的通配符。
文件规范($ branch1)和修订版本范围(@ $ chglist1,@ chglist2)之间不应该有空格 - 它只是一个参数。第一个参数是具有修订范围的源路径,第二个参数是目标路径。
&#34; -c默认&#34;没有必要,因为默认情况下在默认的更改列表中打开文件。
请注意,输出将是命令打开的文件列表,而不是更改列表列表。