What Is a Stream?
A stream is a type of branch. But unlike classic branching, Streams tracks relationships between branches. Developers can easily merge changes because they always know where code should flow.
When you create a stream, it creates a copy of the codeline. This new branch is called a child stream. The codeline which it was created from is called a parent stream. Once the changes are complete in the child stream, the files are copied up to the parent.
Use this guide to walk through how to create a child stream, make a change, and then copy changes up into the parent stream.
How to Set Up Streams
See what you can do with Streams.
Get a tour of Helix Visual Client (P4V).
Before creating your depot, it is vital to map out your branching strategy. This will determine how your code will evolve and how/when developers should branch and merge changes. Take a look at:
- Create a Stream Depot
- Create a Streams Workspace
- Create a Mainline Stream
- Populate your Mainline Stream
Create a Stream Depot
A Stream Depot is where all the code of a project is stored. Once you create a name for a depot, it lives forever. Your depot name defines your naming convention for the entire project. Let’s get started.
- Open P4V.
- In the main menu, choose Tools > Administration to launch P4Admin.
- Connect to Helix server as a user that has admin privilege.
- Choose File > New > Depot.
- Specify a name for the stream depot. Click OK.
- In the dialog box, select steam as the Depot Type.
- Click OK. Verify that your new Stream Depot is listed in the Depot tab.
Create a Streams Workspace
Workspaces in Helix Core are used by developers to work on files. They are used with both classic Perforce and Perforce Steams.
With Streams, creating workspaces is easy. Once it is created, Streams automatically knows what files are available based on the stream it originated from. You can create multiple workspaces for your projects and quickly switch between them.
To create a workspace:
- When you create a new stream, you can select a Create a workspace for use with this stream option.
- Double-click the stream in the Stream Graph and select Work in this stream.
To learn more about workspaces:
Create a Mainline Stream
Your mainline stream will contain the code for your project. It is just one stream type. Create and name your mainline in accordance with your branching strategy.
- Launch P4V and connect to the Helix Core server where you want your stream to reside.
- Choose File > New > Stream.
- In the dialog box, specify the name. You can use "main" or "mainline” depending on the size of your project. Then specify your depot and root folder. For stream type, choose "mainline". The mainline stream does not have a parent.
- Click OK to save your stream specification.
- Verify that your new mainline stream is displayed in the Streams tab. The mainline stream is not displayed in the Depot tab until you populate it with files.
Using Streams for component based development? You can specify an optional depth to keep your code organized.
Populate your Mainline Stream
Once you have created a workspace you can start adding files and making changes. You can populate your mainline stream using files or integrating files from existing depot locations.
- Copy the desired files and folders to the root folder of the workspace you just created. This is the mainline stream.
- In P4V, switch to the left-pane Workspace tab. Your files are displayed as plain file icons. This indicates that they are not in Helix Core yet.
- Right-click the top-level folder and choose Mark for Add.
- In the dialog box, click OK.
- In the Pending Changelists tab, verify that your files are listed in the default changelist and have a red plus sign.
- Right-click the default changelist and click Submit.
- In the dialog box, makk a descriptive comment and click Submit.
- To verify your files have been submitted, check the Log pane at the bottom of the screen and the left-pane Depot tab. If your submission succeeded, your files are listed in the mainline folder.
Now that you have a depot, a stream, and available files you can start working.
How to Branch Using Streams
Branching in Streams follows the merge-down, copy-up best practice. Changes are merged down from the more stable parent stream into the child stream. Changes made in the child stream are copied up.
There are different types of streams available. We are going to talk about three of them.
Start Working in a Stream
To start working in a stream or switch from one stream to another you can either:
- In the Streams tab or the Stream Graph, right-click a stream and select Work in this Stream.
- In the Stream Graph, drag the workspace from your current stream to the one you want to work in.
Your Stream Preferences
Your stream preferences will determine how you work. You can either:
- Use a different workspace and to show an information dialog when switching workspaces.
- Use the same workspace when you switch between streams.
Create a Child Stream
Before you create a child stream, you need to set up a depot, mainline, and added files.
- In the Streams tab, right-click on the stream and select Create New Stream from 'stream_name’.
- In the dialog box, specify the name of your child stream. By default, the name you specify is used as the name of the folder under the stream depot folder. To override the default folder name, go to the Advanced tab.
- Choose the stream type.
- For release and development streams, choose the parent stream. By default, the stream inherits its parent’s stream view. To edit the view of the child stream, go to the Advanced tab. The Advanced tab options enable you to do the following:
- Edit the inherited view.
- Change the default locations of files mapped from the depot.
- Lock the stream settings so that only the owner can edit them.
- Restrict check-ins to the stream owner.
- Allow to merge the stream’s content both up and down.
- Specify file or folder patterns that you want ignored by the stream.
- Select whether to Create a workspace for use with this stream.
- Select whether to Branch files from parent on stream creation. If you choose not to branch files immediately, you can copy them later.
- Click OK to save.
- Verify that the new stream appears correctly in the Stream Graph.
With Streams, you can see and do more. Use these other tools to see how code evolves over time.
Use the Revision Graph in Helix Core to quickly visualize the branching structure of any file.
Use the Time-Lapse view to view and contrast all versions of a file in just one window.
Want Help Setting Up Perforce?
Contact our professional services team to talk to experts. They can optimize your Helix Core servers for top performance.
Do More With P4V
Setting up Perforce is easy with our P4V cheat sheet.
Read the Docs
Get step-by-step instructions on how to install, administer, optimize, and use Helix Core.