Create a project from source control

If a .p4config file is present, it is automatically loaded and your Simulink project is connected to the P4 Server.

Create a project from source control and connect to the P4 Server:

  1. Go to the Simulink Start Page and select the New tab. From the Projects section of the sidebar, select From Source Control > P4 2016b.
  2. Alternatively, you can select the Project from P4 R2016b Simulink template on the New tab.

  3. Set the Sandbox path to your P4 Server Workspace root, this is the location on your local machine you want to populate with the versioned files.
  4. Image of the Simulink Project - Project Retriever dialog

  5. The Repository path needs to be entered as a URI for the P4 Server.
    1. From the New Project From Source Control dialog, click Change to open the P4 Connection dialog.
    2. Image of the Simulink Project - Project Retriever dialog Sandbox path

    3. Enter your P4 Server, Username, and Workspace details and click Connect.
    4. The URI is automatically generated and verified when Simulink successfully connects to the P4 Server.

    5. Click OK to close the dialog and return to the New Project From Source Control dialog. The URI is automatically added to the Repository path of the New Project From Source Control dialog.

  6. Click Retrieve to fetch the files from the P4 Server. If you are prompted to create the Sandbox directory, click Yes.
  7. Image of the Project Retriever dialog ready to fetch files from the P4 Server

  8. If you do not have a valid ticket session for the P4 Server, you will be prompted for your password.
  9. Image of the Password dialog

    If P4 AS is configured for your P4 Server a web page will open and you will be directed to the sign in process used by your Identity Provider (IdP) when you connect to the P4 Server.

  10. If the Workspace specified in your connection does not exist, you are prompted to create one.
  11. Image of the Perforce Connection workspace view mapping dialog

    Set your P4 Server Workspace settings, options are:

    • AllWrite: select to leave all files writable on the client workspace. By default, only files opened by p4 edit are writable. If set, files might be clobbered as a result of ignoring the Clobber option (see below).
    • Clobber: select to permit p4 sync to overwrite writable files on the client workspace. noclobber is ignored if allwrite is set.
    • Compress: select to compress data sent between the client workspace and P4 Server. This is used to speed up slow connections.
    • Locked: select to allow only the client workspace owner to use or change the client spec. Prevents the client spec from being deleted or unloaded.
    • Modtime: select to make p4 sync and p4 submit preserve file modification times, as with files with the +m type modifier. For more information about Modtime, see p4 help filetypes. With nomodtime, file timestamps are updated by sync and submit operations.
    • RmDir: select to delete a workspace folder if all the files contained in the folder are removed.

    If you are connecting to a Stream A special type of branch with built-in rules that determine which changes to propagate to files in a stream depot, and in what order. A stream specification defines a stream. In P4V, stream specs are visible in the Streams Graph and the Streams tab. depot enter your stream details, if you are connecting to a classic depot enter your View Mapping A single line in a view definition, consisting of a left side, a blank space, and a right side. The mappings specify the correspondences between files in the depot and files in a client, label, or branch. See also 'workspace view', 'branch view', and 'label view'. details.

    • Stream: if using streams, specify the full P4 Server depot path for the stream that you want to populate your workspace from.

      Stream at change (optional): enter a changelist number to populate your workspace based on the point in time that is represented by that changelist.

    • View Mapping: map files in the depot to your client workspace. This defines the files that you want in your client workspace and specifies where you want them to reside. The left-hand side specifies one or more files in the depot. The right-hand side specifies one or more files in the client workspace. For details about client view syntax, see the Specify mappings chapter in the P4 CLI Documentation.

    Click OK.

  12. The P4 for MATLAB and Simulink plugin displays the P4 Server depot path and prompts you to specify how the workspace should be populated.
  13. Image of the Pending Changelist dialog

     Options are:

    • Get Latest revision: populates the workspace with the most recent revision of the files in the P4 Server. Typically this is the option you would select.
    • Specify a revision: populates the workspace with the revision of the files you specify from the P4 Server.
    • Advanced Sync Options, these options are only used if you are updating an existing client workspace:
      • Force Operation (p4 sync -f): forces the sync even if the workspace already contains the file at the specified revision.
      • Safe Update (p4 sync -s): performs a safe sync by comparing the content in your client workspace against what was last synced. If the file was modified outside of the control of P4 Server, an error message is displayed and the file is not overwritten.

    Click OK to populate your workspace.

  14. When you are prompted to create the project, enter your project name and click OK.
  15. Image of the Create Project dialog

  16. Simulink displays the Let's get started dialog. To set up your project, click Set Up Project.
  17. The Set up Project (Step 1 of 2) dialog is displayed.

    Image of the Set Up Project (step 1 of 2) dialog

    To add folders and files to your Simulink project, do one of the following:

    • to add all of the files in a folder, click Add Folder..., select the folder, and click Open to move on to the next step.
    • or

    • to add the files in a folder and all of the files in its subfolders, click Add with Subfolders..., select the folder, and click Open to move on to the next step.

    The Set up Project (Step 2 of 2) dialog is displayed.

  18. Specify any startup and shutdown files for the project if they are required.
  19. Image of the Set Up Project (Step 2 of 2) dialog

  20. Click Finish to complete you project setup.
  21. Simulink creates/updates the project files because of the change and they are displayed in the Modified tab.

    Image of the Simulink project file view

  22. To commit the project files to the P4 Server, open the Current Folder view, right-click, and click View and Commit Changes....
  23. Image of the Simulink Commit file dialog

  24. Add a change description to the Comment text box and click Commit to commit the changes.
  25. You can add further files and folders to your project after you have created your project with the Simulink P4 Server menu. For instructions on adding files to your project, see Simulink P4 Server menu.

  26. Your project is now connected to the P4 Server. For details of the P4 Server file and folder operations available to you, see File management.