Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 CLI Documentation | 2025.1

# Populate a mainline stream

Now that you’ve created a stream, you can populate it with files. There are two ways to populate a mainline stream:

- Add files from the local filesystem.
- Branch files from another depot.

In this tutorial, we demonstrate populating by adding files. (To populate by branching from another depot, see Branch from other depots.)

To add files to the mainline stream, copy the files and folders to the workspace root directory, and then mark them for add with the p4 add command.

1. Copy the files and folders to the workspace root directory.

   In this example, we add all files residing in a directory named `/Users/bruno/repository`.

   On UNIX and macOS

       cp /Users/bruno/repository/* /Users/bruno/tutorial

   On Windows

       copy C:\Users\bruno\repository\* C:\Users\bruno\tutorial

2. Change into the client workspace root directory.

   On UNIX and macOS

       cd /Users/bruno/tutorial

   On Windows

       cd C:\User\bruno\tutorial

3. Mark the files for add.

       p4 add *

   Those files are now "opened for add". This creates a default `changelist`, which you will use when you submit to the depot the file you added to your workspace. For more information on changelists, see Changelist-related tasks.

4. Submit the added files with the p4 submit command..

   To populate the stream, submit the default changelist in which the files are open for add.

       p4 submit

   P4 Server opens the `change specification` in an editor:

Copy

    # A Perforce Change Specification.
    #
    #  Change:      The change number. 'new' on a new changelist.
    #  Date:        The date this specification was last modified.
    #  Client:      The client on which the changelist was created.  Read-only.
    #  User:        The user who created the changelist.
    #  Status:      Either 'pending' or 'submitted'. Read-only.
    #  Type:        Either 'public' or 'restricted'. Default is 'public'.
    #  Description: Comments about the changelist.  Required.
    #  ImportedBy:  The user who fetched or pushed this change to this server.
    #  Identity:    Identifier for this change.
    #  Jobs:        What opened jobs are to be closed by this changelist.
    #               You may delete jobs from this list.  (New changelists only.)
    #  Files:       What opened files from the default changelist are to be added
    #               to this changelist.  You may delete files from this list.
    #               (New changelists only.)

    Change: new

    Client: bruno_ws

    User:   bruno

    Status: new

    Description:
        enter description here

    Files:
        //JamCode/main/file1.cc        # add
        //JamCode/main/file1.h # add
        //JamCode/main/file1.txt       # add
        //JamCode/main/file2.cc        # add
        //JamCode/main/file2.h # add
        //JamCode/main/file2.txt       # add
        //JamCode/main/file3.cc        # add
        //JamCode/main/file3.h # add
        //JamCode/main/file3.txt       # add

Enter a description under `Description`, save your changes, and exit the editor. The submit operation stores the files you added in the P4 Server depot. The output might be like this:

    Change 1 created with 9 open file(s).
    Submitting change 1.
    Locking 9 files ...
    add //JamCode/main/file1.cc#1
    add //JamCode/main/file1.h#1
    add //JamCode/main/file1.txt#1
    add //JamCode/main/file2.cc#1
    add //JamCode/main/file2.h#1
    add //JamCode/main/file2.txt#1
    add //JamCode/main/file3.cc#1
    add //JamCode/main/file3.h#1
    add //JamCode/main/file3.txt#1
    Change 1 submitted.

The files you added are now stored in the P4 Server depot.

Your search for returned results