Specify mappings

Remote specs consist of one or more mappings. Each mapping has two parts:

  1. The left-hand side specifies one or more files on the local server.
  2. The right-hand side specifies one or more files on the remote server.

Although the two sides don’t have to name identical paths, they can.

Enclose paths with spaces in quotation marks.

Using wildcards in remote specs

To map groups of files in remote specs, you use Perforce wildcards (*, ...). Any wildcard used on the remote side of a mapping must be matched with an identical wildcard in the mapping’s local side. You can use the following wildcards to specify mappings in your remote spec:

Wildcard Description

*

Matches anything except slashes. Matches only within a single directory. Case sensitivity depends on your platform.

...

Matches anything including slashes. Matches recursively (everything in and below the specified directory).

Now consider another remote spec’s simple DepotPath:

//stream/main/... //depot/main/...

All files in the remote server’s depot path are mapped to the corresponding locations on the local server. For example, the remote server file //depot/main/widget-test/server.txt is mapped to the local server file //stream/main/widget-test/servert.txt.

Mapping part of the depot

If you are interested only in a subset of the depot files on the remote server, map only that portion. Reducing the scope of the local server’s files also ensures that your commands do not inadvertently affect the entire depot. To restrict the local server scope, map only part of the remote server depot to the local server.

Example 1. Mapping part of the remote server depot to the local server.

Remote Spec:

//stream/main/... //depot/main/widget-doc/code/...

In this case, Perforce server will map only the remote server files under the code subdirectory to the local server’s //stream/main directory.

Mapping files to different locations on the local server

Remote specs can consist of multiple mappings; these map portions of the remote server file tree to different parts of the local server. If there is a conflict in the mappings, later mappings have precedence over earlier ones.

Example 2. Multiple mappings in a single local server

The following remote spec ensures that release notes in the remote p4-doc folder reside in the local server in a top-level folder called doc.

Remote Spec:

	//stream/main/src/...	//depot/main/p4/...
	//stream/main/doc/...	//depot/main/p4-doc/relnotes/...

Excluding files and directories

Exclusionary mappings enable you to exclude files and directories from being mapped to a local server. To exclude a file or directory, precede the mapping with a minus sign (-). Whitespace is not allowed between the minus sign and the mapping.

Example 3. Using a remote spec to exclude files from a local server.

Suppose you’re working on a game project and you don’t need the art files to be local:

Remote Spec:
	//stream/main/...	//my_game/...
	-//stream/main/art/...	//my_game/art/...