Modified report procedure

Here is the modified version of Elements_with_Branches.prl.

$start_dir = $0; $start_dir =~ s/\\scripts\\.*/\\scripts/;
$common_dir = $start_dir;
$common_dir =~ s/(.*)\\scripts/$1\\script_tools/;

$cc = ""; if ($cc) {;};
$ct = ""; if ($ct) {;};
$debug = ""; if ($debug) {;};
$skip_path_checks = ""; if ($skip_path_checks) {;};
$CLEARCASE_XN_SFX = ""; if ($CLEARCASE_XN_SFX) {;};
$ctfind_paths = ""; if ($ctfind_paths) {;};
$skip_path_checks = "yes"; if ($skip_path_checks) {;};
$debug = "no"; if ($debug) {;};

sub do_exit {
   $err = join(" ", @_);
   if ("$err" != "") {
      print STDERR "$err\n";
   }
   sleep(2);
   if ("$err" != "") {
      exit(1);
      } else {
   exit(0);
   }
}
open(INCLUDE, "<$common_dir\\common_script.prl") or do_exit("error 
opening include file '$common_dir\\common.prl'"); 
$buf = "";
while(<INCLUDE>) {
   $buf = $buf . $_;
}
close(INCLUDE);
eval $buf || do_exit("error on eval of include file 
'$common_dir\\common.prl'"); 

my $args = $ARGV[0];
$args =~ s/
@args = split(";", $args);
my $ccbranch = "";
$required_args = 0;
foreach(@args) {
   s/^[    ]+//;
   s/[    ]+$//;
   validate_arg_length($_);
   if (/^-i/) {
      print "description : 'Elements with Branches'\n";
      print "id : 2013\n";
      print "helpfile :\n";
      print "parameters : ";
         print "LOOKIN BRANCH";
      print "\n";
### customization change *** deleted following line
   #print_element_rightclick();
### customization change *** added following 8 lines
      print "rightclick : ";
         print "my_rc(single) ";
         print "Properties_of_Element(single) ";
         print "sep ";
         print "Compare_with_Previous_Version(single) ";
         print "Version_Tree(single) ";
         print "History(single) ";
      print "\n";
      print "fields : ";
         print "\"Element Path\"(element_xpn, sort 1, rightclick) ";
         print "\"Branch\"(branch) ";
      print "\n";
   exit(0);
}

if (/^LOOKIN[    ]*=[    ]*('.*')/) {
   #print "paths are $1\n";
   check_lookin($1);
   $required_args++;
   next;
}
if (/^BRANCH[    ]*=[    ]*'*([^']*)'*/)  {
   $ccbranch = $1;
   $required_args++;
   next;
}
print STDERR "unrecognized argument: $_\n";
print STDERR "  ccperl $0 -i\n";
print STDERR "    for script's interface.\n";
do_exit("\n");
}
if ($required_args != 2) {
   print STDERR "usage: not all required arguments specified.\n";
   print STDERR "  ccperl $0 -i\n";
   print STDERR "    for script's interface.\n";
   do_exit("\n");
}
open(CTFIND, "cleartool find $ctfind_paths -nxname -branch 
'brtype($ccbranch)' -print |");
while(<CTFIND>) {
   chomp;
   print "$_;$ccbranch;\n";
}
do_exit();

Here is the new command of my_rc.prl that has been created to support a new pop-up menu command for starting Merge Manager.

# these are all set by set_record_vars in common_rightclick.prl
#
$CLEARCASE_PN = "", $CLEARCASE_XN_SFX = "", $CLEARCASE_ID_STR = "",
$CLEARCASE_XPN = "";
$CLEARCASE_BRANCH_PATH = "", $CLEARCASE_VERSION_NUMBER = "";
$ELEMENT_RESULTS = "", $BRANCH_RESULTS = "", $VERSION_RESULTS = "";
$results = "";

$debug = "no";

$start_dir = $0; $start_dir =~
s/\\scripts_rightclick\\.*/\\scripts_rightclick/;
$common_dir = $start_dir;
$common_dir =~ s/(.*)\\scripts_rightclick/$1\\script_tools/;

open(INCLUDE, "<$common_dir\\common_rightclick.prl") or do_exit("error 
opening include file '$common_dir\\common_rightclick.prl'"); 
$buf = "";
while(<INCLUDE>) {
   $buf = $buf . $_;
}
close(INCLUDE);
eval $buf || do_exit("error on eval of include file 
'$common_dir\\common_rightclick.prl'"); 

if ($CLEARCASE_PN) {;}
if ($CLEARCASE_XN_SFX) {;}
if ($CLEARCASE_ID_STR) {;}
if ($CLEARCASE_XPN) {;}
if ($CLEARCASE_BRANCH_PATH) {;}
if ($CLEARCASE_VERSION_NUMBER) {;}
if ($ELEMENT_RESULTS) {;}
if ($BRANCH_RESULTS) {;}
if ($VERSION_RESULTS) {;}
if ($debug) {;}

$first = "yes";

while(<STDIN>) {
   chomp;
   set_record_vars($_);
########################################################################
# things to be done a record at a time are done here
   if ($first eq "yes") {
      $first = "no";
      open(COMMAND, "clearmrgman |");
      while(<COMMAND>) {;}
      close(COMMAND);
   }
########################################################################
}
# things to be done with the result set as a whole go here

$results =~ s/ $//;

#print "results are $results\n";