Helix server streams are "branches with brains," a containerized approach to managing bodies of related files such as codelines. Streams associate these bodies of related files with rules that define how you can work with those files, including how you can move changes between them. Most notably, streams are defined hierarchically using the mainline model, and Helix server generates the views for workspaces that are associated with a stream based on strictly inherited rules. Among the advantages of this approach are:
- Change is propagated in a controlled way through the hierarchy that you define.
- You can compose the contents of a stream by defining its view, thereby providing all users who work in the stream with a consistent view of its contents.
- Some best practices, such as merge down from parent before allowing copy up to parent, are enforced automatically.
If you are new to working with the Perforce version control system, you have not yet established a robust codeline policy and associated workflow, or you do not have the staff to customize Helix Core server by writing trigger code, using streams is a good option for you. Streams come with reduced administration duties for codeline policy and workspace management, and the Stream Graph provides a graphical representation of the relationship between parent and child streams and whether a merge is required.
The mainline model of software configuration management defines a structure based on the stability of the contents of the stream, from softest (unstable or experimental) to firmest (high quality, releasable). Typically, the mainline is required to be fairly stable (for example, code must build), development codelines less stable, and release codelines the most stable.
A stream is defined not just by its type, but also by its view, which specifies the files and folders that the stream contains and whether they can be edited, merged down, copied up, or branched to a new stream. Stream views define the files that you can work on in your workspace and what you can do with them. They also restrict the files that a child stream inherits from its parent. For example, let's say you have a mainline stream that includes the following directories of files:
//Acme/Main --apps --api --resources --docs
You want to branch to a development stream. You only need to work in the
apps folder, but you need resources from the api and resources folders. You can create a development stream as a child of
Main that includes the files in the
apps folder, excludes the files in the
docs folder, and imports the contents of the
resources folders so you can use them but cannot edit and submit any changes to the depot. You assign a stream view to the child stream that enacts these rules. Helix server generates the workspaces -- and enforces the submit and integration rules -- from the stream view. Any children branched from this new stream inherit those rules. You can assign a more restrictive stream view to subsequent children, but you cannot assign a less restrictive one. Child streams cannot branch more than their parent streams are willing to share.
For more information, see About stream views.
The primary principle of change propagation is merge down, copy up. The goal is to keep less stable streams up to date with their more stable parent or child, so that when change is propagated from a less stable stream to a more stable one, no work is overwritten. This approach keeps the resolve operation as simple as possible. Perforce's merge/copy and resolve features are the means by which you propagate change between streams. When you use streams, all changes are propagated between parent and child streams. If you want to merge or copy between peer streams (for example, to merge another developer's changes to your development stream), you must first reparent your stream (that is, edit the stream specification and change the Parent field). This approach is a key benefit of streams: the ability to configure the flow of change.
For more information, see Merging down and copying up between streams.
Streams are stored in a stream depot, which is displayed in P4V like this: . You cannot add a stream to a "classic" Helix server depot. You can add streams depots through P4Admin or the P4 command-line client.
For more information, see Setting up streams.
Perforce codifies the soft-to-firm model of stability in its standard stream types:
- Mainline: A stream with no parent. Expects merging down from more stable child streams. Expects copying up from less stable child streams. Used as the stable trunk of a stream system.
- Release: A stream that is more stable than its parent. Expects merging down from more stable child streams. Does not expect copying up from its parent stream. Useful for ongoing stabilization, bug fixing, and release maintenance.
Development: A stream that is less stable than its parent. Expects merging down from its parent stream. Expects copying up from its less stable child streams. Does not expect to have more stable child streams. Useful for long-term projects and major new features.
There are two additional stream types with special characteristics:
Task streams are lightweight, short-term branches that you can use for work that affects a small portion of a full project branch. Task streams enable you to work privately, switch contexts quickly, and reduce the amount of metadata managed by Helix server.
For more information, see Working with task streams.
Virtual streams provide users with the ability to restrict the workspace view of a real stream. Virtual streams act as a filter. They are useful when you want to:
- Submit changes directly to a stream but do not want to sync all of the files in the stream view to your workspace.
- Develop against the same stream but switch imported libraries, such as when you develop across multiple platforms.
For more information, see Working with virtual streams.
In the P4V Streams tab, the Stream graph displays soft streams below the mainline and firm streams above it. For example, the following diagram shows a typical software development structure, consisting of a stable mainline, with experimental streams below it and release-quality streams above:
Figure 1. Basic stream structure for software development
In the stream graph, the most stable streams are always at the top and the least stable at the bottom. The stream graph also displays the parent-child relationships that control the propagation of change between codelines. All streams are children of the mainline, and all children can be parents of yet more children of the same type, enabling specific development and release codelines while ensuring that changes are propagated properly between codelines. The stream graph represents those paths of change propagation using arrow connectors.
For more information, see Using the stream graph.
|P4V Term||Command Line Term||Description|
|Stream Root||Stream||The top level under the depot where files in the stream are stored.|
|Stream||Name||A descriptive name that you assign and which is displayed to label the streams in the Stream Graph.|