mrsclean.pl
来自「CMVC是IBM和许多跨国公司的缺陷管理工具。这里给出了很多在Linux下用KS」· PL 代码 · 共 505 行 · 第 1/2 页
PL
505 行
open (REP, "Report -vi changeview -raw -where \"releasename='$rel' and fileId in (select fileId from changeview where defectname in $dbIn) and levelid=0 order by fileid asc, versionid desc, type desc\"|"); undef $oldpath; undef $oldSID; undef $oldtype; while ($chgline=<REP>) { chop $chgline; ($rels,$defect,$lev,$SID,$path,$type) = split(/\|/, $chgline); # Check for same operation (multiple tracks used) if ($path eq $oldpath && $SID eq $oldSID && $type eq $oldtype) { if ($tracks{$defect} ne undef) { $defect_names .= $defect . " "; $had_hit = 1; print LOG "DBa hit $path $SID $type defect $defect_names\n"; } else { # This track isn't one of those to be removed. # Flag this as a miss. Once a miss has been recorded # for a file, we can undo no more operations on it. $miss_track .= $defect . " "; print LOG "DBa miss $path $SID $type defect $defect\n"; } } else { # Change just read is a new operation. if ($oldpath ne undef) { # if not first time, &doFile(); # undo the previous operation. if ($oldpath ne $path) { # This business is to recognize when the new name ($path) # is really the old name of the previous renamed file if ($type ne "delta" || $oldtype ne "rename" || $SID ne $oldSID || $path ne $oldname) { undef $tattled; undef $miss_track; } else { print LOG "DB renamed file recognized, oldname $oldname\n"; } } } # If new change is a rename, we need to find the old name so # we'll know if we see the file again on the next change under # its old name. if ($type eq "rename") { open (REPF, "Report -vi fileview -raw -where \"releasename='$rel' and nupathname='$path'\"|"); while ($fileline=<REPF>) { chop $fileline; ($base,$rels,$comp,$vers,$addD,$dropD,$lastU,$oldname) = split(/\|/, $fileline); print LOG "DB rename save oldname $oldname\n"; last; } close (REPF); } $oldpath = $path; $oldSID = $SID; $oldtype = $type; undef $had_hit; undef $defect_names; if ($tracks{$defect} ne undef) { $defect_names .= $defect . " "; $had_hit = 1; print LOG "DBb hit $path $SID $type defect $defect_names\n"; } else { $miss_track = $defect; print LOG "DBb miss $path $SID $type defect $defect\n"; } } } close (REP); if ($oldpath ne undef) { &doFile(); } # Find all the tracks and cancel them. print LOG " Finding tracks to cancel.\n"; print " Finding tracks to cancel.\n"; undef $defect_names; foreach $track (keys %tracks) { $state = $tracks{$track}; if ($state ne 'dirty') { open (REP, "Report -vi trackview -raw -where \"releasename='$rel' and defectName='$track'\"|"); while ($trkline=<REP>) { chop $trkline; ($rels,$defect,$ref,$st,$targ,$addd,$usrL,$usrN,$usrA,$act,$last,$prefix) = split(/\|/, $trkline); $defect_names .= $defect . " "; if ($prefix eq "f") { $f_canned{$defect} = 1; } else { $d_canned{$defect} = 1; } } close (REP); } } if ($defect_names ne undef) { print LOG " The tracks are $defect_names.\n"; print " The tracks are $defect_names.\n"; print LOG "Track -cancel -release $rel -defect $defect_names\n"; print "Track -cancel -release $rel -defect $defect_names\n"; `Track -cancel -release $rel -defect $defect_names`; } else { print LOG " No such tracks were found.\n"; print " No such tracks were found.\n"; } # Look at the defect/feature for each cancelled track. If there are # no other tracks for the defect/feature, return it. print LOG "\n Finding defects for which all tracks were deleted.\n"; print "\n Finding defects for which all tracks were deleted.\n"; undef $d_to_can; foreach $defect (keys %d_canned) { undef $something_left; open (REP, "Report -vi trackview -raw -where \"defectname='$defect'\"|"); while ($trkline=<REP>) { $something_left = 1; last; } close (REP); if ($something_left eq undef) { $d_to_can .= $defect . " "; } } if ($d_to_can ne undef) { print LOG "Defect -return $d_to_can\n"; print "Defect -return $d_to_can\n"; `Defect -return $d_to_can -remarks \" This defect is being returned because all tracks for it have been cancelled. If this defect is still applicable, please reopen it. Otherwise, cancel it.\"`; } print LOG "\n Finding features for which all tracks were deleted.\n"; print "\n Finding features for which all tracks were deleted.\n"; undef $d_to_can; foreach $defect (keys %f_canned) { undef $something_left; open (REP, "Report -vi trackview -raw -where \"defectname='$defect'\"|"); while ($trkline=<REP>) { $something_left = 1; last; } close (REP); if ($something_left eq undef) { $d_to_can .= $defect . " "; } } if ($d_to_can ne undef) { print LOG "Feature -return $d_to_can\n"; print "Feature -return $d_to_can\n"; `Feature -return $d_to_can -remarks \" This feature is being returned because all tracks for it have been cancelled. If this feature is still applicable, please reopen it. Otherwise, cancel it.\"`; } print LOG "\nCompleted.\n"; print "\nCompleted.\n"; exit 0; sub doFile { if ($miss_track ne undef) { if ($had_hit ne undef && $tattled eq undef) { print LOG "Operation for file $oldpath cannot be undone due to track $miss_track\n"; print "Operation for file $oldpath cannot be undone due to track $miss_track\n"; $tattled = 1; } # Flag the "good" tracks associated with the operation. # They cannot be cancelled because they are blocked by # the "bad" (not selected) tracks which do not allow the undo. for $track (split (/ /, $defect_names)) { $tracks{$track} = "dirty"; } } else { if ($oldfile ne $oldpath) { open (REPF, "Report -vi filesoutview -raw -where \"releasename='$rel' and fileNuPath='$oldpath'\"|"); while ($fileline=<REPF>) { print LOG "File -unlock $oldpath\n"; print "File -unlock $oldpath\n"; `File -unlock "$oldpath"`; last; } close (REPF); } $oldfile = $oldpath; print LOG "File -undo $oldpath -release $rel -force -defect $defect_names\n"; print "File -undo $oldpath -release $rel -force -defect $defect_names\n"; `File -undo "$oldpath" -release $rel -force -defect $defect_names`; } return;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?