Jump to content


Changelist submission trigger

trigger changelist submission trigger

  • Please log in to reply
1 reply to this topic

#1 mshamura

mshamura

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 24 August 2020 - 10:03 AM

Hi Experts,

I am new to perforce triggers and I am trying to write a trigger script which will check for the Copyright notice format in each of the files in the pending changelist, and reject the CL if it copyright notice is missing, or the format is incorrect, or the year is not updated to the current year.

I had few queries related to the above task:

1. What type of trigger must I use for this? change-submit, change-content, and change-commit?
2. I know 'p4 grep' works to search for patterns in a depot. Is there an efficient way (p4 command) to iterate through all the files in a changelist to search for the Copyright Notice pattern?

Would greatly appreciate I could get some pointers to sample scripts.

Thanks in advance.

#2 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 1191 posts

Posted 01 September 2020 - 03:02 PM

  • You want a "change-content" trigger.  At the time the trigger is executed, the changelist will be in a "shelved" state, and you can access the files from most commands via the revision specifier @=CHANGE (where CHANGE is the changelist number, which you can get passed to your script as the %changelist% arg).
  • I think you want the command p4 grep -L -e "COPYRIGHT NOTICE" @=CHANGE






Also tagged with one or more of these keywords: trigger, changelist submission trigger

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users