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

Use this guide to set up Perforce Streams. Create a Stream Depot, a mainline stream, and then add files to your stream. Then you can start making changes.

Not interested in Streams? Get started with classic Perforce >>

See what you can do with Streams.

Get a tour of Helix Visual Client (P4V).

Branching Basics

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

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.

  1. Open P4V.
  2. In the main menu, choose Tools > Administration to launch P4Admin.
  3. Connect to Helix server as a user that has admin privilege.
  4. Choose File > New > Depot.
  5. Specify a name for the stream depot. Click OK.
  6. In the dialog box, select steam as the Depot Type.
  7. 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.

OR

  • 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.

  1. Launch P4V and connect to the Helix Core server where you want your stream to reside.
  2. Choose File > New > Stream.
  3. 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.
  4. Click OK to save your stream specification.
  5. 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.

Learn more about Stream Depth

 

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.

  1. Copy the desired files and folders to the root folder of the workspace you just created. This is the mainline stream.
  2. 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.
  3. Right-click the top-level folder and choose Mark for Add.
  4. In the dialog box, click OK.
  5. In the Pending Changelists tab, verify that your files are listed in the default changelist and have a red plus sign.
  6. Right-click the default changelist and click Submit.
  7. In the dialog box, makk a descriptive comment and click Submit.
  8. 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.

Get Branching Tips

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.

Learn more about other types of streams

Mainline Stream

A mainline stream is often the main codeline for your project. Development and release branches can be made from this stream.

Release Stream

A release stream should include your most stable code. It does not expect copying up from its parent stream, often the mainline. This stream is useful for ongoing stabilization, bug fixing, and release maintenance.

Development Stream

A development stream is usually less stable than its parent. Depending on the complexity of your branching strategy, the parent may be the mainline. These streams can be used for long-term projects and major new features.

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.

  1. In the Streams tab, right-click on the stream and select Create New Stream from 'stream_name’.
  2. 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.
  3. Choose the stream type.
  4. 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.
  5. Select whether to Create a workspace for use with this stream.
  6. Select whether to Branch files from parent on stream creation. If you choose not to branch files immediately, you can copy them later.
  7. Click OK to save.
  8. Verify that the new stream appears correctly in the Stream Graph

Visualize Streams

With Streams, you can see and do more. Use these other tools to see how code evolves over time.

Revision Graph

Use the Revision Graph in Helix Core to quickly visualize the branching structure of any file.

Time-Lapse View

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.