About Stream Views

To configure the files that a stream contains, you define the stream view. The view is composed of a set of paths to which you assign path types that control their behavior. Perforce uses stream views to generate workspace views and branch views for you.

Stream path types

Stream views use the following path types:

  • share: Files in shared paths can be synced (retrieved), submitted, and integrated (branched, merged, and copied). Shared paths are used for files whose changes will flow to and from other streams.

  • isolate: Files can be edited but the resulting changes cannot be integrated to other streams. Isolated paths are useful for storing nightly builds and other generated files, like bin directories.

  • import: Files are sourced from a specified location, and can be synced but cannot be submitted or integrated. Use imported paths for components such as third-party libraries, which are required for building but are never edited. An imported path inherits its view from the parent stream unless its depot location is defined explicitly. Icons of imported files and folders are decorated with a halo in the parent stream from which they are imported.

  • import+: Functions like an import path, in that it can reference an explicitly-defined depot path, but unlike a standard import path, you can submit changes to the files in an import+ path.

  • exclude: Prevents files that would be inherited from the parent files from becoming part of the stream. Files in excluded paths cannot be synced, submitted, or integrated.

The following table shows the behavior of each path type at a glance:

Path type Merge/Copy Branch Sync Submit
share Y Y Y Y
isolate N N Y Y
import N N Y N
import+ N N Y Y
exclude N N N N

Stream path syntax

The syntax for specifying stream paths is similar to Perforce depot path syntax, with the leading //depot name and stream name removed. For example:

Depot path: //Ace/main/qa/...

Stream view path: qa/...

If you want your stream to be able to merge, copy, branch, and submit edits to qa, you'd include a share path like this in the stream view:

share qa/... 

Note

Stream views do not allow wildcards (*), positional specifiers (%%1), or overlay mapping (+).

Inheritance between parents and children

Child streams inherit folder paths and behavioral rules from their parents. When we talk about inheritance between parents and children, it helps to think in the following terms:

  • Permissiveness: what actions (submit, sync, etc) are permitted on a path?

    Path types are inherited from parent streams, and you cannot override the effects of the path types assigned by parent streams. In other words, child streams are always as permissive or less permissive than their parents, but never more permissive. For example, if a parent stream defines a path as isolate, its child streams cannot redefine the path as share to enable integrations.

  • Inclusiveness: what paths are included in the stream?

    Since children cannot, by definition, be more inclusive than their parents, you cannot include a folder path in a child that is not also included its parent. That means, for example, that you cannot add an isolate path to a child if the folders in that path are not also included in the parent. In the following example, the incorrectly defined Dev stream, which is a child of Main, contains an isolate path that will not work, because it includes folders that are not included in the parent. In order to isolate the config/ folder in the Dev stream, that folder has to be included as a share or isolate path in Main:

    Incorrect                        Correct
    Stream: //Acme/Main              Stream: //Acme/Main
    Parent: none                     Parent: none
    Paths:  share apps/...           Paths:  share apps/...
            share tests/...                  share tests/...
                                             share config/...
    
    Stream: //Acme/Dev               Stream: //Acme/Dev
    Parent: //Acme/Main              Parent: //Acme/Main
    Paths:  share apps/...           Paths:  share apps/...
            share tests/...                  share tests/...
            isolate config/...               isolate config/...

Examples

Simple share

Let's start with a simple case: two streams, //Ace/main and its child //Ace/dev.

Stream: //Ace/main
Parent: none
Paths: share ...

Stream: //Ace/dev
Parent: //Ace/main
Paths: share ...

In this case, the entire stream path is shared. When you switch your workspace to the //Ace/main stream, the workspace view looks like this:

//Ace/main/... //your_ws/...

The workspace view maps the root of the//Ace/main stream to your workspace. When you switch your workspace to the //Ace/dev stream, the workspace view is this:

//Ace/dev/... //your_ws/...

And the branch view for //Ace/dev/ looks like this:

//Ace/dev/... //Ace/main/...

In other words, the entire dev stream can be synced to workspaces, and the entire stream can be branched, merged, and copied.

Share and import

Let's look at an example where software components are housed in three separate depots, //Acme, //Red, and //Tango.

The Acme mainline is configured like this:

Stream: //Acme/Main
Parent: none
Paths:  share apps/...
        share tests/...
        import stuff/... //Red/R6.1/stuff/...
        import tools/... //Tango/tools/...

If you switch your workspace to the //Acme/Main stream, this would be your workspace view:

//Acme/Main/apps/... //your_ws/apps/...
//Acme/Main/tests/... //your_ws/tests/...
//Red/R6.1/stuff/... //your_ws/stuff/...
//Tango/tools/... //your_ws/tools/...

The stream's Paths field lists folders relative to the root of the stream. Those are the folders you will get in your workspace, beneath your workspace root. The shared folders are mapped to the //Acme/Main path, and the imported paths are mapped to their locations in the //Red and //Tango depots.

Share, isolate, exclude, and import

Let's say that your team doesn't want to do actual development in the mainline. In this example, the XProd feature team has a development stream of their own, defined like this:

Stream: //Acme/XProd
Parent: //Acme/Main
Paths:  import ...
        isolate apps/bin/...
        share apps/xp/...
        exclude tests/...

Switching your workspace to the //Acme/XProd stream gives you this view:

//Acme/Main/apps/... //your_ws/apps/...
//Acme/XProd/apps/bin/... //your_ws/apps/bin/...
//Acme/XProd/apps/xp/... //your_ws/apps/xp/...
//Red/R6.1/stuff/... //your_ws/stuff/...
//Tango/tools/... //your_ws/tools/...
-//Acme/XProd/tests/... //your_ws/tests/... 

Here we see stream view inheritance at work. Imported paths are mapped to whatever they're mapped to in the parent's client view. The shared and isolated paths are mapped to the child stream; these contain the files the XProd team are working on and will be submitting changes to. And the excluded path (marked with a minus sign in the view) doesn't appear in the workspace at all.

Because the //Acme/XProd stream has a parent, it has a branch mapping that can be used by the copy and merge commands. That branch view consists of the following, with just one path shared by the child and parent (note that you must use P4, the Perforce Command Line Client, to view stream branch views):

-//Acme/XProd/apps/... //Acme/Main/apps/...
-//Acme/XProd/apps/bin/... //Acme/Main/apps/bin/...
//Acme/XProd/apps/xp/... //Acme/Main/apps/xp/...
-//Acme/XProd/stuff/... //Acme/Main/stuff/...
-//Acme/XProd/tests/... //Acme/Main/tests/...
-//Acme/XProd/tools/... //Acme/Main/tools/...

When you work in an //Acme/XProd workspace, it feels as if you're working in a full branch of //Acme/Main, but the actual branch is quite small.

Child that shares all of the above parent

Let's suppose that Bob, for example, creates a child stream from //Acme/XProd. His stream spec looks like this:

Stream: //Acme/BobDev
Parent: //Acme/XProd
Paths:  share ...

Bob's stream has the default view template. Given that Bob's entire stream path is set to "share," you might expect that his entire workspace will be mapped to his stream. But it is not, because inherited behaviors always take precedence; sharing applies only to paths that are shared in the parent as well. A workspace for Bob's stream, with its default view template, will have this client view:

//Acme/Main/apps/... //your_ws/apps/...
-//Acme/BobDev/tests/... //your_ws/tests/...
//Acme/BobDev/apps/bin/... //your_ws/apps/bin/...
//Acme/BobDev/apps/xp/... //your_ws/apps/xp/...
//Red/R6.1/stuff/... //your_ws/stuff/...
//Tango/tools/... //your_ws/tools/...

A workspace in Bob's stream is the same as a workspace in the XProd stream, with one exception: the paths available for submit are rooted in //Acme/BobDev. This makes sense; if you work in Bob's stream, you expect to submit changes to his stream.

By contrast, the branch view that maps the //Acme/BobDev stream to its parent maps only the path that is designated as shared in both streams:

-//Acme/Main/apps/... //XProd/apps/...
-//Acme/BobDev/tests/... //XProd/tests/...
-//Acme/BobDev/apps/bin/... //XProd/apps/bin/...
//Acme/BobDev/apps/xp/... //your_ws/apps/xp/...
-//Red/R6.1/stuff/... //XProd/stuff/...
-//Tango/tools/... //XProd/tools/...

The default template allows Bob to branch his own versions of the paths his team is working on, and have a workspace with the identical view of nonbranched files that he would have in the parent stream.

Remap files

Files can be remapped, which enables you to place them in a workspace location that differs from their depot location. For example, the following view specifies that the parent's docs files reside beneath the doctools path in workspaces defined for this stream.

Remapped:

Remapped: 
docs/... doctools/docs/...

Ignore files

You can specify file types to be ignored, which is useful for ensuring that artifacts such as object files or other interim files are never checked in or integrated. These types are excluded by the workspace view of workspaces associated with the stream. For example:

Ignored:
.swp
.o
/tmp/...