#!/bin/csh
find . \( -name 'core' -o -name '*.contrib' -o -name '*.contrib.[0-9]' -o -name '*.contrib.[0-9][0-9]' -o -name 'findmerge.*' -o -name 'build_log_*' \) -print -exec rm {} \; |
xd: quick diff
#!/bin/sh
if [ $# -eq 1 ]; then |
cl: list the checked out elements
#!/bin/csh if ( $#argv == 0 ) then set dir=. else set dir=$1 endif (cleartool lsco -me -short -cview -d $dir ; cleartool lsco -me -short -cview -recur $dir ) | sed 'sT^\./TT' |
mymerge: integrate on the main branch and label the new version (the file must be currently checked out)
#!/bin/csh set label=$1 shift set comment="$1" shift ct describe lbtype:$label >& /dev/null if ($status) then echo "----> cannot find label $label" exit 1 endif set lock=`ct describe -fmt "%[locked]p" lbtype:$label` if ($lock != "unlocked") then echo "----> label $label is locked" exit 1 endif while ( $#argv > 0 ) set file=$1 if (! -e $file) then echo "$file does not exist" exit 1 endif set branch=`ct ls -d -long $file | sed 's+^.*@@\(.*\)/CHECKEDOUT from /main/.*+\1+'` set integbranch=`dirname $branch` set workbranch=`basename $branch` ct describe brtype:$workbranch >& /dev/null if ($status) then echo "cannot find the branch where $1 is checkedout" exit 1 endif ct ci -ident -com "$comment" $file if ($status) exit 1 diff $file@@$integbranch/$workbranch/LATEST $file@@$integbranch/LATEST >& /dev/null if ( $status == "0" ) then echo "----> $file is the same as on the $integbranch branch" else ct co -com "$comment" $file@@$integbranch/LATEST if ($status) exit 1 ct merge -to $file -version $integbranch/$workbranch/LATEST if ($status) exit 1 ct mklabel -replace $label $file if ($status) exit 1 ct ci -nc $file if ($status) exit 1 ct lsvtree -graph $file if ($status) exit 1 endif shift end |
desintegrate: unintegrate an element version
!/bin/csh set file=$1 set versionID=$2 set version=`ct describe -fmt "%Vn" $1@@/$versionID` foreach label ( `ct describe -fmt "%n" -alabel -all -pname clients | tail +2` ) ct rmlabel $label $1@@$version end foreach hlink ( `ct describe -fmt "%n" -ihlink -all -pname $1@@$version | sed -n 's/.*\(Merge@[0-9]\{1,\}\).*/\1/p' ` ) ct rmhlink $hlink end ct rmver -force $1@@$versio |
vs: summarize the integrations of the last days
#!/usr/bin/perl -w #use strict; my %full_dump; my $max_old = $ARGV[0]; my $file = $ARGV[1]; sub stat_file { my $file = shift; return unless ( -f "$file@@/main/LATEST"); my ($current_year,$current_day) = (gmtime())[5,7]; open(CCL,"/usr/atria/bin/cleartool describe -fmt '%Ln' $file@@/main/LATEST |") or die("cannot get last version ($!)"); my $last_version = <CCL> || "0" ; close(CCL); my $i = $last_version; while ( $i > 1 ) { my $f = $file.'@@/main/'.$i; my $date = (stat($f))[10]; my ($creation_year,$creation_day) = (gmtime($date))[5,7]; my $d = gmtime($date); my $diff = $current_day - $creation_day + 365 * ( $current_year - $creation_year ); last if ( $diff > $max_old ); open(CCC,"/usr/atria/bin/cleartool describe -fmt '%Nc' $f |") or die("cannot get comment ($!)"); my $comment = <CCC> || ""; close(CCC); open(CCU,"/usr/atria/bin/cleartool describe -fmt '%u' $f |") or die("cannot get user ($!)"); my $author = <CCU> or die("cannot read user for file $f ($!)"); close(CCU); if ( defined($full_dump{$diff}{"$author: $comment"})) { $full_dump{$diff}{"$author: $comment"} .= "\n$f - $d" } else { $full_dump{$diff}{"$author: $comment"} = "$f - $d"; } $i--; } } sub scan_dir { my $file = shift; if ( -d $file ) { opendir(DIR,$file); my @list = readdir(DIR); closedir(DIR); foreach( @list ) { scan_dir("$file/$_") if ( $_ ne "." && $_ ne ".." ); } } elsif ( -f $file ) { stat_file($file); } else { die("$file is not a directory or a file"); } } scan_dir($file); for my $v ( sort { $b <=> $a } values %full_dump ) { print "\n--------------------------\n"; while ( my ( $l, $w ) = each (%$v) ) { print "$l\n$w\n\n"; } } |
safecheck:
check that the safety attribute and the safety comment are consistent
|
Perl extracts:
while ( -f $file.'@@/main/'.$i ) { my $f = $file.'@@/main/'.$i; ... $i++; } |
open(CCC,"/usr/atria/bin/cleartool describe -fmt '%Nc'
$f |") or
die("cannot get comment ($!)"); my $comment = <CCC> || ""; close(CCC); |
open(CCU,"/usr/atria/bin/cleartool describe -fmt '%u'
$f |") or
die("cannot get user ($!)"); my $author = <CCU> or die("cannot read user ($!)"); close(CCU); |
Last update: August 30th, 2005 - Laurent