The mktrig command creates a
trigger within a particular depot. A trigger can “fire” before or after certain AccuRev
transactions occur. The following triggers are defined on a per-depot basis, affecting operations only with that particular depot:
When a trigger fires, it executes the trigger program or trigger script that you specify in the
mktrig command. The names of all elements involved in the transaction are passed to this program or script as part of a parameters file.
mktrig does not make a copy of the trigger script. It simply records the location at where AccuRev will look for the script when the trigger fires.
A trigger fires exactly once per transaction. If you do a keep operation on 10 elements and there is a pre-keep trigger set, the trigger script will execute once, with an argument list containing all 10 element names. It is the script’s responsibility to process its entire argument list.
By acting once for the entire transaction, the script can abort a transaction if there is a problem with any element in the transaction, or you can send out a single email message with a list of all of the elements, instead of a separate message for each element in the transaction. For a transaction with 100 elements, that's a real benefit!
The trigger script must be installed in a place that is accessible to everyone that will be using a depot with the trigger enabled. Separate copies of the script can be placed on each client machine. A better procedure is to place all scripts in a central, network-wide location that all client machines can “see” (UNIX/Linux mount or Windows network share). If triggers will fire on both Windows and UNIX/Linux machines, be sure to read
Notes on Triggers in Multiple-Platform Environments on page 80 of the
AccuRev Administrator’s Guide.
When a trigger fires, AccuRev looks for a script at the location you specify in the
mktrig command. A pre-transaction trigger fires on the client machine:
Note: AccuRev uses a search path to locate the trigger script if you specify a simple name or a relative pathname for the script in the
mktrig command (this is our recommendation); if you specify an absolute pathname for the script, no search path is involved.
For a pre-promote-trig trigger, you can invoke a built-in trigger procedure that implements the transaction-level integration between AccuRev and AccuWork. The integration procedure records the transaction number of each
promote command in the
affectedFiles field of a particular issue record.
As with any pre-promote-trig trigger, this applies to a particular depot. You can specify the depot with the
-p option.
The triggers described above operate on a per-depot basis. For example, a pre-create-trig trigger might be activated in depot
gizmo, but not in depot
whammo. Two additional triggers execute on the AccuRev server machine:
You enable these triggers not with the mktrig command, but by installing the trigger scripts at well-known locations. For details, see
Server-Side Triggers on page 75 of the
AccuRev Administrator’s Manual.
AccuRev’s issue management facility, AccuWork, also supports triggers. See
server_dispatch_post on page 79 of the
AccuRev Administrator’s Guide.