triggers -- Modify list of pre-submit triggers p4 triggers p4 triggers -o p4 triggers -i 'p4 triggers' edits the table of pre-submit triggers. Triggers are user-defined commands that are run on the server during changelist submission to validate the changelist. The commands are run on the server after the changelist is created and the files are locked but before any files are transferred. Thus triggers cannot validate the contents of files being submitted. The trigger form has a single entry 'Triggers', followed by any number of trigger lines. Triggers are executed in the order listed and if a trigger fails subsequent triggers are not run. A trigger succeeds if the command executed exits 0 and fails otherwise. If it fails, the command's standard output (not error output) is used as the text of the trigger failure error message. Each trigger line contains a trigger name, a depot file path pattern, and a command to run: Name: The name of the trigger. A run of the same trigger name on contiguous lines is treated as a single trigger, so that multiple paths may be specified. Only the command of the first such trigger line is used. Path: Files which will cause the trigger to be run. This is a file pattern and may be an exclusion mapping (-pattern) to exclude files. Command: The command to run to validate the changelist. If the command contains spaces, the whole command must be quoted. The following variables are expanded in the command string: %change% -- the changelist being submitted %client% -- the client submitting the changelist %clienthost% -- the hostname of the client %clientip% -- the IP address of the client %serverhost% -- the hostname of the server %serverip% -- the IP address of the server %serverport% -- the IP address:port of the server %serverroot% -- the value of the server's $P4ROOT %user% -- the user submitting the changelist More information can be gathered about the changelist being submitted by running p4 describe %changelist% The -o flag causes the trigger table to be written to the standard output. The user's editor is not invoked. The -i flag causes the trigger table to be read from the standard input. The user's editor is not invoked. 'p4 triggers' requires superuser access granted by p4 protectExamples
Triggers: reject0 //....out "sh /usr/local/admin/scripts/reject.sh %change% .out" reject1 //....OUT "sh /usr/local/admin/scripts/reject.sh %change% .OUT" reject2 //....tmp "sh /usr/local/admin/scripts/reject.sh %change% .tmp" reject3 //....TMP "sh /usr/local/admin/scripts/reject.sh %change% .TMP" reject4 //....log "sh /usr/local/admin/scripts/reject.sh %change% .log" reject5 //....LOG "sh /usr/local/admin/scripts/reject.sh %change% .LOG" reject6 //....tws "sh /usr/local/admin/scripts/reject.sh %change% .tws" reject7 //....twr "sh /usr/local/admin/scripts/reject.sh %change% .twr" reject8 //....dfPackage "sh /usr/local/admin/scripts/reject.sh %change% .dfPackage"