Now that you have been introduced to all of the components that are part of the AccuRev gated streams feature set -- gated streams, staging streams, and the server_admin_trig trigger -- let’s walk through a simple use case to see how these components work together to help ensure that changes are promoted and shared with others only when ready.
The barcon depot uses a stream hierarchy that might look familiar to many software development organizations. It contains a product release stream, barcon; a
QA stream for testing; and a build stream,
integration. Individual developers dfoster, oarmstrong, and hchance have workspaces off the integration stream.
In this stream structure, the developers promote their changes to the integration stream. A build is run when changes are promoted, as well as on a nightly schedule; if the build succeeds, the developer promotes the changes to the
QA stream for testing. Other developers on the team are free to update their workspaces as soon as changes are promoted to
integration.
Once the administrator creates the gated stream nightly_build, the developers reparent their workspaces to it, as shown in the preceding illustration. Under the covers, AccuRev creates a staging stream for each of the reparented workspaces, like those shown here:
As mentioned previously, you can write Perl to make an AccuRev trigger do anything you want. For the barcon depot, the
server_master_trig trigger has been customized to start a build when changes are promoted, and it includes code that updates the status of the staging stream based on the build’s results.
In this example, the changes promoted to nightly_build broke the build, as indicated by both the status icon and tooltip displayed on the
nightly_build_staging_1 staging stream:
At this point, the user hchance needs to fix his code before he promotes it back to the
nightly_build_staging_1 staging stream. Once he does, the trigger re-executes and the build is run again. This time, assuming the fixes are valid and the build succeeds, the changes are promoted from the staging stream, through the gated stream, where they become part of the
integration stream’s default group and will be available to the others when they update their workspaces.
Tip: Note that the gated stream displays a status icon that reflects the status of its staging streams, even when those streams are not displayed. See
Understanding Gated Stream Status for more information.