# Work with Streams

Streams provide an alternate approach to maintaining codelines.

Starting with release 2012.1, P4Eclipse provides the following support for streams:

- Creating a Stream Spec
- Populating a Stream
- Viewing Stream Hierarchy
- Creating a Stream Client
- Copying and Merging Changes between Streams

If your organization uses streams, you will see streams depots in the P4 Connections view. Streams depots are marked with the icon. A hierarchical view of the streams and their relationships to each other is displayed in the P4 Streams view, along with each stream's name, root, parent, owner, type, and description. If P4V (the Perforce Visual Client executable) is available, you can also obtain the P4V Streams Graph by clicking the Streams Graph icon in the P4 Streams view.

## Create a Stream Spec

From the P4 Streams view (or the Create New Stream from... context menu item), click the Create a New Stream button . The New Stream wizard will pop up. To create a new Stream spec, follow the wizard's prompts and click Finish. Click Refresh button on the view toolbar to refresh the view and display the new stream.

## Populate a Stream

A stream spec defines a path in the stream depot. If the path does not exist, you need to populate the stream with content.

To populate a stream:

You can check the Branch files from parent on stream creation button in the New Stream wizard.

Alternatively, you can:

- Create a new connection in the P4 Connections view and set your Perforce workspace's Stream value to the stream you want to populate.
- In the P4 Stream view, select the stream and choose Merge to Stream.
- Select the parent stream as the source, select Merge, Resolve any files (accepting the source), and then submit the changelist.

If you are familiar with P4V, you can also:

- Invoke the P4V graph view to populate the stream from the P4 Streams view.
- Note: in order to enable context menu functionality in the stream graph, you will need to select the P4V Preference named Use the same workspace, and switch it between streams. (You can set this preference in the Streams page of P4V Preferences.)
- Use the context menu in the P4V Graph View as you would otherwise use it from within P4V.

## Delete a Stream

You can delete a stream if it has not children. To delete: select a stream from P4 Streams view and choose Delete Stream from context menu.

## View Stream hierarchy

The P4 Streams view can show streams either as a tree or list . If you have P4V configured in the preferences page, the P4V Stream Graph view can also be invoked from the P4 Streams view toolbar .

## Create a Stream Client

To work with a stream depot, a stream client is needed. To create a stream client, select a connection from the P4 Connections view, select Edit Perforce Workspace... from the context menu, set the Stream field (and optionally, specify the AtChange field), and save the spec.

### Work in a Stream

Alternatively, you can select the context menu Work in this Stream... of the P4 Streams View, P4Eclipse will prompt you to either update the current Perforce client to associate with selected stream, or create a new client to associate with the selected stream, based on the preference. The default behavior is to update the current client to associate with the selected stream.

Once you select the stream client, P4Eclipse will automatically switch the Perforce workspace and synchronize the existing projects to the latest revision.

## Copy and Merge Changes between Streams

Consider the following set of streams:

After fixing a bug or implementing a new feature in a development stream, you may want to copy up your changes to the main stream. Or you may want to merge down the changes from the main stream to the development stream.

Prior to the 2012.3 release, you needed to manually switch to target streams. Since the 2012.3 release, the support for automatically switching between streams was added and working with multiple streams is much easier.

### Auto-switch streams

When you invoke the Copy to Stream... and Merge to Stream... actions, P4Eclipse will automatically switch to the target stream if necessary.

#### To copy changes from the development stream to the main stream:

- Open P4 Streams view, and select the main stream, context-click Copy to Stream..., if you are currently in dev stream, P4Eclipse will automatically switch to the main stream, and synchronize the resources.
- You can then follow the prompts from the Copy to Stream wizard, and click Copy to finish.
- Resolve the pending changelist and submit the change.

#### To merge changes from the main stream to the development stream:

- Open P4 Streams view, and select the dev stream, context-click Merge to Stream..., if you are currently in main stream, P4Eclipse will automatically switch to the dev stream, and synchronize the resources.
- You can then follow the prompts from the Merge to Stream wizard, and click Merge to finish.
- Resolve the pending changelist and submit the change.

## Work with Task Stream

Task stream provide a light way to branch streams. Usually you work with task stream for a minor bug fix or a small feature development.

P4 Eclipse provide following support for task stream, and most of them are available from the P4 Streams view:

- Create a task stream
- Populate a task stream
  - From parent stream
  - From a depot
- Work in a task stream
- Delete a task stream
- Unload/reload a task stream
- Re-parent a task stream

### Task Stream Workflow

The following workflow is suggested but not required:

- Create a task stream relate to a task (feature or bug)
- Checkout files in task stream
- Modify the files in the task stream
- Submit files to task stream
- Copy changes up to parent
- Unload or delete task stream