[p4] Modifying Changelist form

Ivey, William william_ivey at bmc.com
Fri Aug 21 08:19:10 PDT 2009

Not really, but you can reject the submit with an explanation of which fields
were not properly filled out. By the way, in cases like this I always provide
an override, usually in the form of a comment, for example: # OVERRIDE
because there will always be cases where the normally required information
is not applicable. You can have the trigger insert a statement into the
description that the use overrode the trigger.

Keep in mind that you don't want to tie up the submit process too long,
and you don't want triggers to fail and reject perfectly valid submits. So
you want to make them fast and robust, and if an internal error occurs
I usually have the trigger return success on the theory that failing safely
means accepting the submit even if it can't be properly checked.


From: Kamlesh Mutha [mailto:mkamlesh at gmail.com]
Sent: Friday, August 21, 2009 2:46 AM
To: Ivey, William; Perforce Users Mailing List
Subject: Re: [p4] Modifying Changelist form

Just a step ahead, I want to get some more information from User for each submission.

Something like:
Backlog / Feature Description:
Change Description :
Code reviewed by:
Unit Testing done : Yes / No
Klockwork run : Yes / No

This text can also be included in the change form as discussed before in this thread.
But can we have some additional form which will pop up at the time of submit/changelist creation, with all such questions so that we have information related to any change stored on perforce server.

Thanks and Regards,

On Tue, Aug 11, 2009 at 10:48 PM, Ivey, William <william_ivey at bmc.com<mailto:william_ivey at bmc.com>> wrote:
My "reviewer" trigger looks for the the string that's normally
only found in new change forms: "<enter description here>" so it
won't add the "reviewed by" line again to an existing change
form. It's written for bourne shell (standard for our triggers)
and uses the sed command, but otherwise it is very similar to
what you have:

sed -e "s/<enter description here>/&\n\n# Fill in reviewer's name\
 below\nReviewer: <name>/" "$formFile" > "$TMPFILE"

(The & inserts the matched text, then follows it with a blank
line, a comment, and the Reviewer: field.


-----Original Message-----
From: perforce-user-bounces at perforce.com<mailto:perforce-user-bounces at perforce.com> [mailto:perforce-user-bounces at perforce.com<mailto:perforce-user-bounces at perforce.com>] On Behalf Of Kamlesh Mutha
Sent: Saturday, August 08, 2009 3:39 AM
To: Perforce Users Mailing List
Subject: [p4] Modifying Changelist form
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:

$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 :

       reviwer form-out change "/home/builduser/modify_change.pl

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

Thanks and Regards,

Faith waiting in the heart of a seed promises a miracle of life which it can
not prove!
-Ravindranath Tagore
perforce-user mailing list  -  perforce-user at perforce.com<mailto:perforce-user at perforce.com>

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