![]() |
Telelogic SYNERGY (steve huntington) | ![]() |
Topic Title: Update Project History Topic Summary: Script updates project history of working state project to match reconfigure properties baseline project Created On: 13-Oct-2006 20:40 Status: Read Only |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
#!/usr/std/bin/perl5.6.1
# This script will re-evaluate the history links of your projects and then # set them according to the "baseline" value. The history info will be # not be changed if the baseline information is not appropriate. # # the script takes any number of arguments: # databases to operate on # # 01 SEP 2006: Modified to only operate on working state project (since # prep state project history is preserved when doing "Create # Baseline". (script used to operate on both working and prep # state projects) # Todd Alden # # Make perl handle print buffer flushing $| = 1; # Set your environment variables here $ENV{CCM_HOME}="/vol/ccm64"; foreach $database (@ARGV) { $ENV{CCM_ADDR} = `$ENV{CCM_HOME}/bin/ccm start -d $database -m -q -nogui -r ccm_admin`; @ccm_status = `$ENV{CCM_HOME}/bin/ccm status`; $in_session = grep /\(current session\)/, @ccm_status; # If the user isn't in a CCM session, print an error and die if(! $in_session) { die "$0: CM Synergy session not started\n"; } # Find all working projects which have a baseline @projects = `$ENV{CCM_HOME}/bin/ccm query "status='working' and has_baseline_project(cvtype='project')" -u -f %objectname`; chomp @projects; foreach $project (@projects) { print " project name before clean up: $project \n"; # Clean up the project name $project =~ s/\s*$//; print " project name after clean up: $project \n"; # Find the baseline $relate_data = `$ENV{CCM_HOME}/bin/ccm relate -s -n baseline_project -f "$project" -fmt "%objectname::~%objectname~"`; print " relate_data: $relate_data \n"; ($trash, $baseline) = split /~/, $relate_data; chomp $baseline; print " baseline after chomp: $baseline \n"; # Does the baseline project exist? undef $exist; $exist = `$ENV{CCM_HOME}/bin/ccm attr -s name "$baseline"`; if($exist) { # Is the baseline different than itself? if($project ne $baseline) { # OK check it's predecessor and update it from the baseline if needed @predecessors = `$ENV{CCM_HOME}/bin/ccm relate -s -n successor -t "$project"`; print " predecessor_0: $predecessors[0] \n"; $predecessors[0] =~ s/ successor.*$//; $predecessors[0] =~ s/ //g; chomp $predecessors[0]; print " predecessor_0: $predecessors[0] \n"; if($predecessors[0] ne $baseline) { undef $exist; $exist = `$ENV{CCM_HOME}/bin/ccm attr -s name "$predecessors[0]"`; # Make sure the predecessor exists before doing the unrelate if($exist) { system("$ENV{CCM_HOME}/bin/ccm unrelate -name successor -f '$predecessors[0]' -t '$project'"); } system("$ENV{CCM_HOME}/bin/ccm relate -name successor -f '$baseline' -t '$project'"); } else { print "Project $project baseline is already the predecessor.\n" } } else { print "Project $project has itself as the baseline.\n" } } else { print "Project $project has a non-existent or invalid baseline.\n" } } system("$ENV{CCM_HOME}/bin/ccm stop"); } ##### End of script ###### |
|
![]() |
Telelogic SYNERGY
» Scripts and Customizations
»
Update Project History
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.