There are two different configuration options to consider when setting up your client workspace to work with streams:
- Define a single workspace, and switch it between streams.
- Define multiple workspaces, one for each stream.
The configuration you choose will ultimately depend on your workflow. Additionally, each option has advantages and disadvantages with respect to shelving and disk space.
Option 1: Define a single workspace, and switch it between streams
A single workspace is defined for all your work. When you need to work in a different stream, you re-associate or switch your workspace to the other stream. After switching your client, the files in the workspace are synced to the contents of the other stream. No updates are made to the files in your workspace if the contents are identical to the files in the other stream. The main advantages of this option are reduced disk space and network usage - only the file contents that differ between respective streams need to be synced to the workspace. The disadvantage of this option is that work in progress must be shelved or submitted prior to initiating the switch.
Enable this option in P4V by clicking Edit > Preferences > Connection tab. Under the heading When performing stream operations, select the option Use the same workspace and switch it between streams.
Enabling this option with the P4 command-line client involves creating a single client workspace specification as you normally would. Then, when you wish to re-associate your workspace, you must shelve or submit your work in progress, switch your client stream association, and sync to the other stream. For example, assuming that you are working in the stream
//ace/dev, and want to work in
//ace/rel1.0, you would issue the following commands to switch and then sync:
p4 client -s -S //ace/rel1.0
Option 2: Define multiple workspaces, one for each stream
A distinct and separate workspace is defined for each stream that you work in. This is the default mode of operation under P4V. Each time you need to work in a different stream, you change to a different workspace. The main advantage of this model is that work in progress does not need to be shelved or submitted before working in a different stream. The disadvantage is that this option consumes more disk space.
This is the default configuration with a newly-installed P4V client. This configuration option can be found by clicking Edit > Preferences > Connection tab. The option appears under the heading When performing stream operations, and is labelled Use a different workspace for each stream. You can optionally turn off notification warnings when you switch between streams by checking the option Don't warn me when switching workspaces.
Enabling this option with the P4 command-line client is equivalent to creating a different client specification for each stream, and switching between the clients as needed. Be sure to set the
Stream field in the client specification form for each client that you define. Alternatively, you can use the
-S option of the p4 client command to create the specification without editing a form. For example, the following command will define a client called
devclient that has its client root in the current directory, and is associated with the stream
p4 client -o -S //ace/dev devclient | p4 client -i
Note: for the command-line client, you can make use of environment variables or P4CONFIG files to help you manage which client you are using.