#! /bin/bash # # Description: # Trigger to block submission of changelists which contain any variation of # "do not submit" (case/spacing insensitive) on the first line of the changelist # description. # # Use: # "DoNotSubmit.sh -p %serverAddress% -c %changelist%" # # Trigger use: # DoNotSubmit change-submit //DepotPathForTargetFiles/... # ".../TriggerDirectory/DoNotSubmit.sh -p %masterServer% -c %changelist%" # # Author: Joe Robinson # Created: 2013/06/28 # Editor: $Author$ # Edited: $DateTime$ # File: $File$ # ADMIN OPTIONS: #---------- # Regular expression to examine description field against. regex=[^[:alnum:]]*DO[^[:alnum:]]*NOT[^[:alnum:]]*SUBMIT[^[:alnum:]]* # LOCATION of p4 binary (server-side) p4binary="/usr/local/bin/p4" # User to run 'p4 change' command as. Example: "someServiceUser" userArg="someServiceUser" #---------- # Ignore case for regular expression matching. shopt -s nocasematch descString=`$p4binary -ztag -p $2 -u $userArg describe $4 | grep "... desc" -m 1 | sed "s/... desc //"` if [[ $descString =~ $regex ]] then echo " --- DoNotSubmit (sh) REJECTED changelist $4." else #echo " --- DoNotSubmit (sh) ACCEPTED changelist $4." exit fi
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 8330 | Joe Robinson | Fixed sha-bang. | ||
#1 | 8328 | Joe Robinson |
Added completed bash script. License file. |