Push-submit triggers
Use the push-submit
trigger type to create triggers that
fire after changelist creation, but before files are transferred to the
shared server. Because push-submit triggers fire before files are
transferred to the server, these triggers cannot access file contents.
Push-submit triggers are useful for integration with reporting tools or
systems that do not require access to file contents.
As mentioned in the previous section where submit and push processing was described, push processing limits the commands you can run in a push-submit trigger. Please use the following commands only:
p4 change -o %changelist% p4 describe -s %changelist% p4 files //path/...@=%changelist% p4 fstat //path/...@=%changelist%
Example
The following push-submit trigger is an MS-DOS batch file that rejects a changelist being pushed if the changelist description does not contain a line of the form Reviewed and approved ("signed off") by: XXXXXXXX .
@echo off if not x%1==x goto doit echo Usage is %0[change#] exit 1 :doit p4 describe -s %1 | findstr "Reviewed and signed off" > nul if errorlevel 1 echo "Changelist %1 missing review information."
To use the trigger, add the following line to your triggers table:
sample1 push-submit //depot/qa/... "reviewcheck.bat %changelist%"
Every time a changelist is pushed that affects any files under
//depot/qa
, the reviewcheck.bat
file is called.
If the string "Reviewed and signed off
" is detected, the
script assumes that the required review has happened and permits the
changelist push to continue. Otherwise the push is rejected.
The p4 change
and p4 describe
commands do not display associated fixes when run from the push-submit
or push-content triggers, even if the changes being pushed have
associated fixes that are added as part of the push.