How to set a stream to become a event-stream and execute event-stream triggers after demote operation completes


In the CLI Users Guide (Link:, it is briefly mentioned on page 91 that:

"You can execute the event-stream trigger on the server after the demote operation completes. This trigger fires when a demote occurs in the parent stream of an event stream. You can use this trigger to perform actions based upon the demote operation, such as automatically starting a build after the demote has taken place".

Moreover, the eventStream is a stream attribute which you can configure on a stream. To configure it, you will need to use the chstream command using the -E option:

accurev chstream -E t -s <stream name>

Once you have run this command, the target stream will become an event stream. An event stream trigger will be fired if there are any content changes on the stream itself. (this includes the demote operation)

The sample script provided by Accurev for the event-stream trigger is the script Installation details are provided within the script's comments.

*Note: The script is a repository-wide script, which means it affects all the depots.

Within the script, there is a sub-routine called runStreamEvent which one can customize to perform post-demote operations. This can also be the place where you can start a build after the demote has taken place.

*Note: There might also be a need to implement some form of logic within this sub routine to see what operation results in the stream event as a stream event simply fires when there are content changes. If you un-comment the Dumper(...) statement in the subroutine, you will see the XML input parameters in the triggers.log which you can use (I.e. transaction ID) to discern what operation results in the firing of this event.

Comment List
Related Discussions