#!/usr/local/bin/perl #----------------------------------------------------------------------# # /Copyright 1999 Cimatron Ltd. # # # # Perl name : rep.pl # # Programmers : Eli Ofek & Yael Stern # # # # Description: New SCM Reports System for cimatron # # # # Invocation: # # See Help sub Below... # # # # Notice: * This script creates an error log called: RErrors.log # # When the file becomes big - you should manualy DELETE it. # # # # # #----------------------------------------------------------------------# #----------------------------------------------------------------------# # Set general parameters: # #----------------------------------------------------------------------# sub GetCfg($,$) # This sub reads values from a cfg file { # Input: , # OutPut: Returns the value of the requested variable read from the file. my $FileName = shift; # Get file name to read from. my $VarName = shift; # Get Var name to look for. my $Value=""; # Holds the returned value. my $FoundName; my $FoundVal; my @AllFile; # Holds the configuration file. my @Vars; # Holds the configuration file without comments. my $path; # Get path To //p4ctrl/pcfs/cfg/ $path=`p4 sync //p4ctrl/pcfs/cfg/... 2> null`; if ($?!=0) {&ErrorDie("Cannot run : p4 sync //p4ctrl/pcfs/cfg/... 2> null . Failed in sub GetCfg.");} $path=`p4 where //p4ctrl/pcfs/cfg/...`; if ($?!=0) {&ErrorDie("Cannot run : p4 where //p4ctrl/pcfs/cfg/... . Failed in sub GetCfg.");} $path=~/\S*\s\S*\s(\S*)\.\.\./; $path = $1; my $cmd = join('',"type ",'"',"$path\\$FileName",'"'); @AllFile=`$cmd`; # Read the file if ($?!=0) {&ErrorDie("Cannot run : $cmd . Failed in sub GetCfg.");} @Vars = grep ((!/^#/ and !/^\n/),@AllFile); # Eliminate comments. foreach $Vars (@Vars) { # chomp($Vars); $Vars=~/(\S*)\s*:=\s*(.*)\n/; $FoundName = $1; $FoundVal = $2; if ($FoundName eq $VarName) { $Value = $FoundVal; last; } } if (length($Value)<1) { &ErrorDie("Cannot Find Variable $VarName in file $FileName ! . Failed in sub GetCfg.");} return $Value; } my $timestmp = 0; # Scalars for time stamp. my $sec = 0; my $min = 0; my $hour = 0; my $mday = 0; my $mon = 0; my $year = 0; my $wday = 0; my $yday = 0; my $isdst = 0; my @Versions=""; # An array to keep versions of project configuration. my $PREver=0; # Current project PRE version number. my $DEVver=0; # Current project DEV version number. my $INTver=0; # Current project INT version number. my $QATver=0; # Current project QAT version number. my $PRDver=0; # Current project PRD version number. my $NewVer=0; # New version Num. my $SCLver=""; # SCL version. my $TempFile=&GetCfg("nscm.cfg","TempFile"); # Name of temporary file. @TempArr=""; # A temporary array. @TempArr2=""; # A temporary array. my $TempVar=""; # A temporary var. my $LabelName=""; # A var to keep Label Name. my $LabelName2=""; # A var to keep Label Name. my $LabelFile=&GetCfg("nscm.cfg","LabelFile"); # A var for filename of label properties. my $Root=""; # Path to user's Root directory of Perforce. my $User=""; # UserName from p4 info my $PROJ=""; # A var for project name. my $CONF=""; # A var for configuration name. my $OrgCONF=""; # A var for configuration name. my $Counter=0; # A simple counter. my $ArgNum=""; # A var to keep the number of arguments passed to the script. my @Users=""; # A var to keep names of users passes to the script. my $UserNum=""; # A var to keep number of users passed to the script. my @Groups=""; # A var to keep names of groups passes to the script or keep perforce Groups. my $GroupNum=""; # A var to keep number of groups passed to the script. my @Labels=""; # A var to keep names of labels passes to the script. my $LabelNum=""; # A var to keep number of labels passed to the script. my $DateF=""; # Avar to keep date to search from. my $DateT=""; # Avar to keep date to search to. my @MGrepOut=""; # An Array to keep MultiGrepCut output. my @GrepOut=""; # An Array to keep GrepCut output. my @Buffer=""; # An Array to keep source buffer. my @Buffer2=""; # An Array to keep source buffer. my @OutPut=""; # An Array to output. my @FinOutPut=""; # An Array to output. my @TempOutPutDates=""; # An Array for a temporary cut output of Dates. my $Users=""; # A var to keep a list of perforce users. my $Labels=""; # A var to keep a list of perforce labels. my $Changes=""; # A var to keep a list of perforce changes. my @Changes=""; # A var to keep a list of perforce changes. my $ArgPlace=1; # A var to index how many Args were read from STDIN. my $Data=""; # A Var to keep temporary data to transfer between subrutines. my $Mix=""; # A Var to specify kind of report. my $Mode=""; # A var to specify a mode of action. my $IsPending=0; # A flag to know if we want alist of pending changelist (to know if to add "deafult by"). # Declaring subroutines # #----------------------------------------------------------------------# # Help Sub: ############################# sub Help { print "\n\n Invocation: \n\n"; print " Use: \n"; print " \n"; print " perl rep.pl < > ... \n"; print " \n"; print " = \n"; print " -ul : Print Perforce User List. (No cut) \n"; print " -gl : Print Perforce Group List. (No cut) \n"; print " -gul : Print Perforce Group & User List. (No cut) \n"; print " -ll : Print Perforce Labels List.(No cut) \n"; print " -pc : show all configurations for a specified Project. \n"; print " -pc2 : show all configurations for a specified Project,if the project is IT-show the Elite's configurations also. \n"; print " -pcall : show all configurations for all Projects (uniq). \n"; print " -fdsc : Show a full description of a given change# \n"; print " -gdsc : Show a full description of a given group \n"; print " -diff <(optional)-full for :sort by files -fullu or -g > for :sort by user> \n"; print " Show the different files between the Label and the Head revision. \n"; print " -diff2 <(optional)-full for :sort by files -fullu or -g > for :sort by user> : \n"; print " Show the different files between two Labels. \n"; print " -diff3 <(optional)-full for :sort by files -fullu or -g > for :sort by user> : \n"; print " Show the different files between two trees. \n"; print " -diffoneh <(optional)-full for :sort by files -fullu or -g > for :sort by user> : \n"; print " Show the files that present on Head revision but not on label specified. \n"; print " -diffonel <(optional)-full for :sort by files -fullu or -g > for :sort by user> : \n"; print " Show the files that present on label specified but not on Head revision. \n"; print " -diffone2 <(optional)-full for :sort by files -fullu or -g > for :sort by user> : \n"; print " Show the files that are in Label 1 but not in LAbel 2. \n"; print " -diffone3 <(optional)-full for :sort by files -fullu or -g > for :sort by user> : \n"; print " Show the files that are in Tree 1 but not in Tree 2. \n"; print " -eql <(optional)-full for :sort by files -fullu or -g > for :sort by user> : \n"; print " Show equal files between the Label and the Head revision. \n"; print " -eql2 <(optional)-full for :sort by files -fullu or -g > for :sort by user> : \n"; print " Show the equal files between two Labels. \n"; print " -eql3 <(optional)-full for :sort by files -fullu for :sort by user> : \n"; print " Show equal files between two trees. \n"; print " -arstochs < -dt to include Changes details -ndt to omit or -ndtnt to omit titles too> :\n"; print " Create Submitted changes report for each Ars given. \n"; print " -arstochp < -dt to include Changes details -ndt to omit or -ndtnt to omit titles too> : \n"; print " Create Pending changes report for each Ars given. \n"; print " -abytochs < -u > or <-g >:\n"; print " Create Submitted changes report for each ABY login given. \n"; print " -abytochp < -u > or <-g >: \n"; print " Create Pending changes report for each ABY login given. \n"; print " -chtoars : \n"; print " Create Ars report for each change # given.(including associated changes. \n"; print " -schp : \n"; print " Show changelist details for each pending chnagelist given. \n"; print " -schs : \n"; print " Show changelist details for each submitted chnagelist given. \n"; print " -msynch : Sync to a list of changes(takes last revision if files are duplicated). \n"; print " -unsynch : UnSync to a specified change(sync to X-1 revision) - only if revision>1. \n"; print " -mintegch < -r to resolve -nr not to reslove > : Integrate a list of changelists from the same branch, or from IT to Elite/.../OFF202, to a destination branch. \n"; print " -mintegchcheck : Check if integrate will clobber files in the private work. \n"; print " -rdf revert all the files in the changelists that where check out for delete. \n"; print " -res resolve all the files in the changelists. \n"; print " -unsub unsubmitting a changelist, (the version before the one in the changelist will be head revision. \n"; print " -autointg a new changelists will be created to all the target of the configuration \n"; print " -lf < -dt to include Labels details -ndt to omit>