mrsclean.pl
来自「CMVC是IBM和许多跨国公司的缺陷管理工具。这里给出了很多在Linux下用KS」· PL 代码 · 共 505 行 · 第 1/2 页
PL
505 行
#!/bin/perl## SAMPLE NAME: mrsClean# This is a PERL script.## FUNCTIONS: Clean up release (from CMVC_RELEASE).# Remove work associated with the input tracks,# the tracks themselves and any empty levels.# Return defect/feature if track cancelled and# there are no others (in other releases).# The user running the script must have sufficient# authority (superuser, projectLead?) for the CMVC# commands being issued. Otherwise, mrsClean may# miss a few spots. If other, non-specified, tracks# interfere with the undoing of a File operation, a# warning message is printed and logged. The script# must be rerun with the interfering track(s) included# to complete the job.## Output logged to mrsClean.log in working directory.## USAGE: mrsClean defectName(s) featureName(s)## ENVIRONMENT# VARIABLE(S): CMVC_FAMILY CMVC_RELEASE [CMVC_BECOME]## ORIGINS: 27## 5765-039 (C) COPYRIGHT International Business Machines Corp. 1991,1995# 5765-207 (C) COPYRIGHT International Business Machines Corp. 1994,1995# 5765-202 (C) COPYRIGHT International Business Machines Corp. 1994,1995# 5622-063 (C) COPYRIGHT International Business Machines Corp. 1994,1995# 5765-069 (C) COPYRIGHT International Business Machines Corp. 1991,1995# All Rights Reserved# Licensed Materials - Property of IBM## US Government Users Restricted Rights - Use, duplication or# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.### NOTICE TO USERS OF THE SOURCE CODE EXAMPLES## INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THE SOURCE CODE# EXAMPLES, BOTH INDIVIDUALLY AND AS ONE OR MORE GROUPS, "AS IS" WITHOUT# WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT# LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A# PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE# OF THE SOURCE CODE EXAMPLES, BOTH INDIVIDUALLY AND AS ONE OR MORE GROUPS,# IS WITH YOU. SHOULD ANY PART OF THE SOURCE CODE EXAMPLES PROVE# DEFECTIVE, YOU (AND NOT IBM OR AN AUTHORIZED RISC System/6000* WORKSTATION# DEALER) ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR OR# CORRECTION.## * RISC System/6000 is a trademark of International Business Machines# Corporation.### glw 04/11/94 Pull rib from mrClean# wrh 10/06/95 Leave empty levels alone, thats a job for mrClean##-----------------------------------------------------# SCCS keyword @(#)44 1.3 1/8/03#----------------------------------------------------- push(@INC,split(/:/,$ENV{"PATH"})); # define search path if ($#ARGV < 0) { print ("Specify defect/feature name(s) as argument, please.\n"); print ("USAGE: mrsClean defectName(s) featureName(s)\n\n"); print ("Clean up release (from CMVC_RELEASE).\n"); print ("Remove work associated with the input tracks,\n"); print ("and the cancel the tracks if possible.\n"); print ("Return defect/feature if track cancelled and\n"); print ("there are no others (in other releases).\n"); print ("The user running the script must have sufficient\n"); print ("authority (superuser, projectLead?) for the CMVC\n"); print ("commands being issued. Otherwise, mrsClean may\n"); print ("miss a few spots. If other, non-specified, tracks\n"); print ("interfere with the undoing of a File operation, a\n"); print ("warning message is printed and logged. The script\n"); print ("must be rerun with the interfering track(s) included\n"); print ("to complete the job.\n"); print ("Output logged to mrsClean.log in working directory.\n"); exit 2 } open (LOG,">>mrsClean.log") || print "cannot open logfile ($!)"; $rel = $ENV{"CMVC_RELEASE"}; if ($rel eq undef) { print "Specify a release in the CMVC_RELEASE environment parameter.\n"; exit 16; } print LOG "\n***** Processing release $rel *****.\n"; print "\n***** Processing release $rel *****.\n"; # Check that the release exists open (REP, "Report -vi releaseview -raw -where \"name='$rel' and dropDate is null\"|"); undef $found; while ($relline=<REP>) { chop $levline; ($lname) = split(/\|/, $levline); $found = 1; last; } close (REP); if ($found eq undef) { print LOG " Release $rel not found.\n"; print " Release $rel not found.\n"; exit 16; } print LOG " Check state of the specified tracks.\n"; print " Check state of the specified tracks.\n"; $dbIn = "("; foreach $track (@ARGV) { if ($tracks{$track} ne undef) { print "track $track previously specified.\n"; next; } # Check state of the track undef $found; open (REP, "Report -vi TrackView -raw -where \"releasename='$rel' and defectName='$track'\"|"); while ($trkline=<REP>) { chop $trkline; ($rels,$defect,$ref,$state) = split(/\|/, $trkline); $found = 1; last; } close (REP); if ($found eq undef) { print LOG "track $track not found.\n"; print "track $track not found.\n"; exit 8; } if ($state eq 'approve' || $state eq 'integrate' || $state eq 'fix' || $state eq 'build') { $dbIn .= $delim . "'" . $track . "'"; $delim = ","; $tracks{$track} = $state; print LOG "track $track in $state state.\n"; print "track $track in $state state.\n"; } else { print "track $track in $state state. Cannot proceed.\n"; exit 8; } } $dbIn .= ")"; print LOG " Remove tracks from any level.\n"; print " Remove tracks from any level.\n"; foreach $track (keys %tracks) { $state = $tracks{$track}; if ($state eq 'approve') { # Track is in the approve state. Cancel it. print LOG "Track -cancel -defect $track\n"; print "Track -cancel -defect $track\n"; `Track -cancel -defect $track`; } else { # Remove track from any levels. open (REP, "Report -vi LevelMemberView -raw -where \"releasename='$rel' and defectName='$track'\"|"); while ($memline=<REP>) { chop $memline; ($lev,$rels,$defect) = split(/\|/, $memline); print LOG "LevelMember -delete -level $lev -defect $track\n"; print "LevelMember -delete -level $lev -defect $track\n"; `LevelMember -delete -level $lev -defect $track`; } close (REP); # If track in integrate state, move it back to fix. if ($state eq 'integrate') { print LOG "Track -fix -defect $track\n"; print "Track -fix -defect $track\n"; `Track -fix -defect $track`; } # Re-activate any complete fix records. open (REP, "Report -vi fixview -raw -where \"releasename='$rel' and state='complete' and defectname='$track'\"|"); while ($fixline=<REP>) { chop $fixline; ($defect,$rels,$comp) = split(/\|/, $fixline); print LOG "Fix -activate -component $comp -defect $track\n"; print "Fix -activate -component $comp -defect $track\n"; `Fix -activate -component $comp -defect $track`; } close (REP); } } # Delete any "working" state levels. # i.e. those with no tracks. #print LOG " Getting rid of any levels with no tracks.\n"; #print " Getting rid of any levels with no tracks.\n"; #open (REP, #"Report -vi levelview -raw -where \"releasename='$rel' and state='working'\"|"); #while ($levline=<REP>) { # chop $levline; # ($lname) = split(/\|/, $levline); # print LOG "Level -delete $lname -release $rel\n"; # print "Level -delete $lname -release $rel\n"; `Level -delete $lname -release $rel`; #} #close (REP); # Get list of all uncommitted changes in the release. # group by file, latest change first (= higher versionid) => desc # include the type in order clause. If there is rename and delta # at same sid, the desc will put renames ahead of delta print LOG " Finding changes to undo.\n"; print " Finding changes to undo.\n";
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?