[p4] Modifying Changelist form

Kamlesh Mutha mkamlesh at gmail.com
Sat Aug 8 01:38:46 PDT 2009


Hi All,

Objective is to insert "ReviewedBy" field text in every changelist form.
This is what I have done and seems to be working fine in my test setup.

Trigger Script:

#!/usr/bin/perl
$formfile = $ARGV[0];  # from %formfile% in trigger table

$defaultin = "^Description:";
$defaultout = "Description:\n\tReviewedBy =>\n";

# Build a modified workspace spec based on contents of %formfile%
$modifiedform = "";
open FORM, $formfile or die "Trigger couldn't read form tempfile";
while ( <FORM> )
{       ## Do the substitution as appropriate.
        if ( m:$defaultin: ) { $_ = "$defaultout"; }
        $modifiedform .= $_;
}
# Write the modified spec back to the %formfile%,
open MODFORM, ">$formfile" or die "Couldn't write form tempfile";
print MODFORM $modifiedform;
exit 0;
[ Snippet of the script from perforce site ]

Triggers setup :

Triggers:
        reviwer form-out change "/home/builduser/modify_change.pl
%formfile%"


Does this look alright or is there any better way to do it?

Thanks and Regards,
Kamlesh





-- 
Faith waiting in the heart of a seed promises a miracle of life which it can
not prove!
-Ravindranath Tagore



More information about the perforce-user mailing list