Settings Default File Types

Published by Marco on in Perforce

Each file in Perforce has a type, which includes the type of contents and special flags for handling the file on the server. The content types are usually binary or text (OS X users will notice the apple type being used for binary files with resource forks). The flags control things like compression, header expansion (+k) or which revisions are stored on a server.

To set the default file types, use the Perforce typemap command.

  1. Open a command window.
  2. Type “p4 typemap” (it will open in the default text editor for the operating system).
  3. Add type mapping under the “TypeMap:” title block in the file (see below for examples).
  4. Close and quit the text editor to save the changes (if there are errors, Perforce will open the file again).

Each default type map consists of file type flags and a depot path.

  • A list of valid flags is available at File Types.
  • Examples and documentation is available at p4 typemap.

Examples

Binary+S //….doc

This prevent Perforce from storing multiple versions of Microsoft Word documents.

  • //….doc selects all files and sub-folders in the depot with the .doc extension.
  • The +S indicates that only the head revision should be stored.
Binary+S //Projects/Databases/…/*_test.db

This is similar to the type setting above, but applies only to testing databases (ending in _test.db) in the Projects/Databases folder (and subfolders).

Note: Make sure to include a [Tab] at the beginning of each line or Perforce will not accept the typemap!