Fix-add and fix-delete triggers
Example
The following script, when copied to fixadd.sh and fixdel.sh, fires when users attempt to add or remove fix records, whether by using the p4 fix command, or by modifying the Jobs field of the forms presented by the p4 change and p4 submit commands.
#!/bin/bash # fixadd.sh, fixdel.sh - illustrate fix-add and fix-delete triggers COMMAND=$0 CHANGE=$1 NUMJOBS=$(($# - 1 )) echo $COMMAND: fired against $CHANGE with $NUMJOBS job arguments. echo $COMMAND: Arguments were: $*
These fix-add and fix-delete triggers fire
whenever users attempt to add (or delete) fix records from changelists.
To use the trigger, add the following lines to the trigger table:
sample4 fix-add fix "fixadd.sh %change% %jobs%" sample5 fix-delete fix "fixdel.sh %change% %jobs%"
Using both copies of the script, observe that:
-
fixadd.shis triggered byp4 fix -
the
fixdel.shscript is triggered byp4 fix -d -
and either script can be triggered by manually adding (or deleting) job numbers from within the
Jobsfield in a changelist form. This can be done either by means ofp4 changeor as part of thep4 submitprocess.
Because the %jobs% variable is expanded to one argument
for every job listed on the p4 fix command line (or
in the Jobs field of a p4 change or
p4 submit form), it must be the last argument
supplied to any fix-add or fix-delete trigger
script.






