About streams
Helix server streams provide an approach to managing bodies of related files, such as codelines. Streams associate these files with rules that define how users can work with those files, including how users can move changes between them. Streams are defined hierarchically using the mainline model, and Helix server generates the views for workspaces that are associated with a stream. 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.
This chapter focuses on working with streams in P4V. For additional stream-related information, see:
- the Streams chapter in the Helix Core Server User Guide
- the p4 stream command in the Helix Core P4 Command Reference
-
the description of the dm.stream.parentview and dm.integ.streamspec configurables in the Helix Core P4 Command Reference
Stream depots
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.
Stream types
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.
- See Working with virtual streams
The mainline model
The mainline model of software configuration management defines a stream hierarchy |
|
The mainline stream is the parent of the release and development streams.
Propagating change between streams
The 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 allow you to propagate change between 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. To reparent a stream, 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.
The stream specification and inheritance
A stream specification, also called the stream spec, has a set of field names.
The Advanced tab of the Stream: Edit dialog shows the stream view. The stream view consists of the The stream view controls the files and paths that compose a stream and defines how those files are propagated.
|
|
Prior to P4V 2020.3, a stream always inherited its view from its parent stream.
Starting with P4V 2020.3, this inheritance is associated with the stream spec's ParentView field having the value of inherit
.
This assumes that P4V is running against the 2020.2 version or later of Helix Server.
You might want to set up release streams to not inherit from the parent stream so changes to the parent stream do not affect the release streams. To provide this kind of flexibility, release, development, and mainline streams can have the ParentView field set to noinherit
when the stream is created or at any time thereafter.
When the stream is created, the Parent view
field of the Stream: New dialog is affected by the value of the dm.stream.parentview configurable.
(default) |
|
1
|
|
2
|
|
For any time after the stream is created, see Convert the Parent View of a stream.
A mainline stream has no parent, so inherit
versus noinherit
is relevant only if the mainline stream is converted to another type of stream.
In some cases, a child stream that does not inherit its view from its parent might benefit from changes in the parent's view. Such a child stream can integrate the changes. See Stream spec integration.
Stream views and branching
Stream views:
- define the files that you can work on in your workspace and what you can do with them
- restrict the files that a child stream inherits from its parent, if the stream is configured to inherit 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 api
and 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 from the stream view. The stream view enforces the submit and integration rules. Any children branched from this new stream inherit those rules, if those streams inherit from their parent.
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 Stream view configuration.
Stream hierarchy in the Stream Graph
The stream graph displays the parent-child relationships that control the propagation of change between codelines. All streams are children of the mainline. All children can be parents of yet more children. This enables specific development and release codelines while ensuring that changes are propagated properly between codelines. The stream graph represents those directions of change propagation using arrow connectors.
The Stream graph displays soft streams below the mainline and firm streams above it. A typical software development structure consists of a stable mainline (main1
), with less stable or "softer" development streams below it (dev1
, dev2
, dev11
, dev22
), and the most stable or "firmer" release streams, such as rel1
, above:
![](../Resources/Images/p4v-streamgraph-noinherit.png)
The mainline stream is the parent of rel1
, dev1
, and dev2
.
- The blue band on
rel1
,dev2
, anddev11
means those streams arenoinherit
and therefore do not inherit their view from their respective parent streams. - The grey band on
dev1
anddev22
mean those streams do inherit their view from their respective parent streams. - The mainline stream has no parent, so its band color has no meaning unless the mainline stream is converted to a different stream type.
Suppose that in preparation for a future release, the mainline gets a new set of library files. A noinherit
release stream can continue to build as usual, independent of changes to the parent stream.
For more information, see Using the Stream Graph.
Terminology differences between command line client and P4V
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. |