p4 switch

Synopsis

Create a stream or switch to a different stream, with an option to populate that stream, or to display current streams.

Syntax

p4 [g-opts] switch [-c -m -v -P parent] [-Rx] [-r] stream stream
p4 switch [-r -v] [-Rx] stream@change
p4 switch -l -L
p4 switch

Description

This command allows you to create, manage, and switch between your streams. Note that p4 switch automatically performs a p4 reconcile and p4 sync as part of its operations and automatically shelves work in progress when switching between streams.

The stream@change argument sets the workspace view to match the version of a stream as of the specified changelist, and syncs the files to the versions matching that same changelist.

You cannot switch to a new stream if files are open in a numbered changelist. If files are open in the default changelist, they are shelved and reverted prior to switching to the new stream; they are automatically unshelved when switching back to this stream.

Options

With no options specified, p4 switch displays the current stream.

-c

Specifies that the new stream be created and populated with a copy of the files that are in the current stream.

-l

Lists all known streams.

-L

Lists all streams that were switched at the specified change with open files.

-m

Specifies that switch -c should create a new stream with no parent. This would be an independent mainline. The new stream is initially empty.

-P parent

Specifies that p4 switch -c should create a new stream with the specified stream as its parent. The new stream is populated with the files from the specified stream, rather than with the files from the current stream.

-r

Reopens files in the new mapped location of the specified stream.

If you omit this option and you have opened files in the current stream, those files are shelved before switching to the new stream; they are unshelved when you switch back to this stream.

-Rx

Controls how files are reconciled when switching between streams:

  • Ra reconcile files not currently under Perforce control. (Files open for add.)
  • Re reconcile files that have been modified. (Files open for edit.)
  • Rd reconcile files that have been removed. (Files marked for delete.)
  • Rn reconcile does not run.

-v

Verbose mode.

Usage Notes

Can File Arguments Use Revision Specifier? Can File Arguments Use Revision Range? Minimal Access Level Required

N/A

N/A

open to use the -c or -r options,
list to use the -L option,
or write for default switching

Examples

p4 switch -r bugfix17

Switch to the bugfix17 stream and open all the files in it.

Related Commands

Merge

p4 merge

Resolve

p4 resolve