12.9 Associate Changes with Change Orders

To keep track of work done in response to an engineering change order (ECO), you can use attributes and triggers. For example, to associate a version with an ECO, define ECO as an integer-valued attribute type:

cleartool mkattype -c "bug number associated with change" -vtype integer ECO
Created attribute type "ECO".

Then, define an all-element trigger type, EcoTrigger, which fires whenever a new version is created and runs a script to attach the ECO attribute:

Trigger Definition:

cleartool mktrtype -element -all -postop checkin -c "associate change with bug number" ^
-execunix "Perl /public/scripts/eco.pl" -execwin "ccperl \\neon\scripts\eco.pl" ^
EcoTrigger
Created trigger type "EcoTrigger".

Trigger Action Script:

$pname = $ENV{'CLEARCASE_XPN'};

print "Enter the bug number associated with this checkin: ";
$bugnum = <STDIN>;
chomp ($bugnum);
$command = "cleartool mkattr ECO $bugnum $pname";

@returnvalue = `$command`;
$rval = join "",@returnvalue;
print "$rval";

exit(0);

When a new version is created, the attribute is attached to the version. For example:

cleartool checkin -c "fixes for 4.0" src.c
Enter the bug number associated with this checkin: 2347
Created attribute "ECO" on "G:\dev\src.c@@\main\2".
Checked in "src.c" version "\main\2".

cleartool describe src.c@@\main\2
version "src.c@@\main\2"
...
Attributes:
ECO = 2347