Jump to content


How to test trigger scripts without 'p4 submit'

trigger submit

  • Please log in to reply
1 reply to this topic

#1 p4hudson

p4hudson

    Member

  • Members
  • PipPip
  • 13 posts

Posted 30 July 2015 - 10:32 PM

Hi,
Is there a way to test trigger scripts without actually submitting?
Or something like "p4 submit -n ..."?
Does trigger scripts inherit system environments (as set by .cshrc or .bashrc, etc.)?

Thanks,

#2 P4Sam

P4Sam

    Advanced Member

  • Members
  • PipPipPip
  • 484 posts
  • LocationSan Francisco, CA

Posted 01 August 2015 - 04:39 PM

Trigger scripts are executed by p4d and inherit its environment -- NOT the environment of the client running the command that fired the trigger.

When writing a trigger script I make as few assumptions about the environment as possible, and specify all the P4 environment settings as global options (e.g. "p4 -p 1666 -u perforce -P <infiniteticket> ...").

It's generally not too hard to mimic the inputs to a trigger, but it depends on the trigger type.  A change-submit trigger fires on a pending changelist, so try it out by running your script and passing it the number of a pending change.  For a change-content trigger a shelved change will mimic it pretty well; for a form trigger just dump a form to a text file and pass that as the argument, etc.





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

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users