6. Using a Trigger to Maintain a Reference Tree

6. Using a Trigger to Maintain
a Reference Tree
Reference trees allow you to have a physical copy of the most recent sources for a stream. They are available for reference, thus the name reference tree. Snapshots never change, so they only need to be updated once using update –r and then you can forget about them.
To create a reference tree, use the mkref command. To keep a reference tree up to date with its associated stream, you need to run update on the reference tree every time versions are promoted to the stream.
AccuRev supplies the following trigger scripts to automate this procedure:
server_post_promote.pl
A general-purpose script, which can be used to perform various tasks after completion of every promote command. In this case, we're going to have it call the update_ref.pl script.
update_ref.pl
A script that invokes the update command to update the files in a reference tree. On a UNIX/Linux machine, this script must be setUID-root.
The indirection is necessary for security purposes.
To enable the automatic updating of one or more reference trees, follow these steps:
1.
server_post_promote.pl
update_ref.pl
See Operating-System User Identity of the Server Processes of the AccuRev Administrator’s Guide.
2.
Edit both the server_post_promote.pl and update_ref.pl scripts, and follow the step-by-step instructions contained within them.
3.
pl2bat server_post_promote.pl
pl2bat update_ref.pl
4.
Tell AccuRev to run the server_post_promote script after every promote command:
accurev mktrig server-post-promote-trig server_post_promote.pl (UNIX/Linux)
accurev mktrig server-post-promote-trig server_post_promote (Windows)
For more information, see the descriptions of mkref, mktrig, and show triggers commands.
 

Micro Focus