Step 6: Configure typemap settings | Admin

By default, P4 attempts to automatically detect if files should be stored as text or binary data, and sets all files to read-only until you check them out. To ensure that P4 Server handles files with specific extensions or files in specific folders in a specific way, set up a typemap. A typemap can also let you limit the number of versions of a file stored on the server, which saves server space.

If you need to set up a typemap, you must do it before your team starts working on versioned files with P4. Files on the server before the typemap has been implemented are not affected by the typemap. Only files added to the server after the typemap is created or modified are affected by the typemap.

If you are configuring P4 Server with a game engine, you must set up a typemap to ensure that binary assets can only be edited by one person at a time.

If you are not configuring P4 Server with a game engine, read through the information on this page and determine whether you need a typemap or not.

Configure a typemap

Complete the following steps to configure the typemap.

  1. At a command prompt, enter p4 typemap and press Enter.

    The typemap opens in your default text editor.

    The typemap must open in its own window. If typemap not saved is displayed, close all instances of your text editor and run the command again. If p4 client error is displayed, make sure that you are using the correct P4PORT, including the hostname or IP and port for your P4 Server.
    • To view your default P4 settings, type p4 set.

    • To change the P4PORT value, type p4 set P4PORT=correct server address where correct server address is the P4 Server IP address or and port, for example, 192.168.0.1:1666 or p4d-1.example.com:1666. Then, enter p4 set again to view the new values you set.

  2. Under the TypeMap: add lines for each file extension or path.

    To learn more, see Syntax. If you are using P4 with a game engine, you can use examples in Universal game engine typemap.

  3. Save the typemap file and close the text editor.

    If the typemap is valid, Typemap saved is displayed at the command prompt. If the typemap is invalid, an error is displayed indicating that the typemap was not saved.

Syntax

Each line in the typemap has two parts, with a space between each part.

In the first part, there is a file type or modifier, or both.

  • You can specify a file type first, such as binary or text, and then use + to add modifiers. For example, binary+w.

  • If you have more than one modifier in a line, do not add + between modifiers. For example, binary+wl.

In the second part, there is a depot path pattern.

  • Start a pattern with //, followed by the depot path and either * for all files in the folder or a specific file pattern. Always use forward slashes. For example, //..._BuiltData.uasset.

  • Use ... as a wildcard to match any number of characters in any subfolders.

  • Use * as a recursive wildcard to match any number of characters, but no subfolders,

For example, binary+wS2 //..._BuiltData.uasset indicates that:

  • The server detects any files ending with _BuiltData.uasset in any depots, streams, and subfolders as binary data.

  • Files ending in _BuildData.uasset in workspaces are writable.

  • The server keeps only the two most recent versions of files ending in _BuiltData.usasset.

For more typemap examples, see Examples and Define filetypes with p4 typemap in P4 Server Administration Documentation.

Common modifiers

The following are common typemap modifiers. For a complete list, see File types in the P4 CLI Reference.

Modifier Description Use this for:
w Keeps files writable in workspaces. By default, files are read-only until they are checked out. Files that are updated automatically that you want to track, such as log and build files.
l Set exclusive locking for files. When the file is checked out, it is automatically locked so others cannot edit it. Binary files, such as game engine files, 3D models, images, and movies that cannot be merged. These files should not be edited by multiple users at the same time.
S# Only stores the most recent versions of the file. Replace # with the number of revisions to keep. For example, +S2 stores the most recent two versions. For large files and files that change often to save space on the server.

Examples

What's next

Next, create a stream depot, the highest level of organization on a P4 Server.

Go to Step 7: Create a stream depot.