Create streams

p4 switch -c [stream] creates a new stream and populates it with a copy of all the files in the current stream.

$ p4 switch -c dev
dev

A quick comparison reveals that the two streams contain identical files:

$ p4 diff2 //stream/main/... //stream/dev/...
==== //stream/main/a/test1.txt#1 (text) - //stream/dev/a/test1.txt#1 (text) ==== identical
==== //stream/main/a/test2.txt#1 (text) - //stream/dev/a/test2.txt#1 (text) ==== identical

The -P parent option specifies that p4 switch -c should create a new stream with the specified stream as its parent, rather than the default of the current stream; thus the new stream will be populated with the files from the specified parent stream, rather than the files from the current stream.

$ p4 switch -c -P main child_of_main
child_of_main

As the following output demonstrates, //stream/main is the parent of //stream/child_of_main:

$ p4 stream -o //stream/child_of_main
# A Perforce Stream Specification.
#
#  Stream:       The stream field is unique and specifies the depot path.
#  Update:       The date the specification was last changed.
#  Access:       The date the specification was originally created.
#  Owner:        The user who created this stream.
#  Name:         A short title which may be updated.
#  Parent:       The parent of this stream, or 'none' if Type is mainline.
#  Type:         Type of stream provides clues for commands run
#                between stream and parent.  Five types include 'mainline',
#                'release', 'development' (default), 'virtual' and 'task'.
#  Description:  A short description of the stream (optional).
#  Options:      Stream Options:
#                       allsubmit/ownersubmit [un]locked
#                       [no]toparent [no]fromparent mergedown/mergeany
#  Paths:        Identify paths in the stream and how they are to be
#                generated in resulting clients of this stream.
#                Path types are share/isolate/import/import+/exclude.
#  Remapped:     Remap a stream path in the resulting client view.
#  Ignored:      Ignore a stream path in the resulting client view.
#
# Use 'p4 help stream' to see more about stream specifications and command.

Stream:	//stream/child_of_main

Update:	2015/02/06 10:57:04

Access:	2015/02/06 10:57:04

Owner:	jschaffer

Name:	//stream/child_of_main (created by switch command)

Parent:	//stream/main

Type:	development

Options:	allsubmit unlocked toparent fromparent mergeany

Paths:
	share ...