You can use AccuRev triggers to help prevent some of the actions that can lead to incomplete change packages. For general information about these triggers, see the discussion of
server_preop_trig in the Administrator’s Guide, and the sample
server_preop_trig.pl file in the AccuRev installation
examples folder. The Perl snippets below take the examples provided in the sample
server_preop_trig.pl file one step further and show how you can prevent non-administrators from purging files from higher-level streams, and how to enforce promote-by-issue in non-workspace streams.
# only a user listed as an administrator can promote versions
# to a stream in the "admin_stream" list
#if ( defined($admin_stream{$stream2}) and `$::AccuRev ismember $principal "$admingrp"` == 0 ) {
# print TIO "Promoting to a stream identified as an 'admin stream' disallowed:\n";
# print TIO "server_preop_trig: You are not in the $admingrp group.\n";
# only a user listed as an administrator can run the Promote
# command without entering a comment
if ( $comment eq "" and `$::AccuRev ismember $principal "$admingrp"` == 0 ) {
print TIO "Empty comments for 'promote' command disallowed:\n";
print TIO "server_preop_trig: You are not in the $admingrp group.\n";
# end of EXAMPLE VALIDATION
#This will prevent users from promoting or cross promoting individual files.
#Only users defined in the $admingrp group will be allowed to promote by file.
#This will prevent issues from becoming incomplete which can cause coalescing problems.
#foreach my $changepackage (keys(%{$$xmlinput{'changePackagePromote'}})){
#my @issues = (@{$$xmlinput{'changePackagePromote'}[0]{'changePackageID'}});
my @noissue = (@{$$xmlinput{'changePackagePromote'}});
foreach my $issue (@noissue) {
#foreach my $issue (@issues) {
#print "Array Issue num = $issue\n";
if ($issue == 0 and `$::AccuRev ismember $principal "$admingrp"` == 0 ){
print TIO "Promotion by file is disallowed.\n";
print TIO "You need to promote by issue, please select the issue which needs promotion and
print TIO "Only users in the $admingrp group are able to promote by file as this can cause
# end of EXAMPLE VALIDATION
# no problems, allow command to proceed
# $command AccuRev command being run
# $principal Username of person invoking command
# $ip IP address of AccuRev client machine
# $stream1 Stream from which versions are being purged
# $fromClientPromote Data passed from pre-promote-trig script
# only a user listed as an administrator can promote versions
# to a stream in the "admin_stream" list
#if ( defined($admin_stream{$stream1}) and `$::AccuRev ismember $principal "$admingrp"` == 0 ) {
# print TIO "Purging from a stream identified as an 'admin stream' disallowed:\n";
# print TIO "server_preop_trig: You are not in the $admingrp group.\n";
# end of EXAMPLE VALIDATION
#Prevent users from purging elements so AccuWork issue will not become incomplete in streams.
unless ( $stream1=~/_$principal/ or `$::AccuRev ismember $principal "$admingrp"` == 1 ) {
print TIO "You can not perform \"Revert to Backed\" or purge operations in streams.\n";
print TIO "This will prevent CR's from disappearing in streams due to them becoming
print TIO "Only users in the $admingrp group will be authorized to preform this
# no problems, allow command to proceed