File Types

Perforce supports six base file types:

File type modifiers are then applied to the base types allowing for support of RCS keyword expansion, file compression, and more.

When adding files, Perforce first examines the typemap table to see if the system administrator has defined a file type for the file(s) being added. If a match is found, the file’s type is set as defined in the typemap table. If a match is not found, Perforce examines the first bytes of the file based on the filesys.binaryscan configurable (by default, 65536 bytes) to determine whether it is text or binary, and the files are stored in the depot accordingly.

By default, text file revisions are stored in reverse delta format; newly-added text files larger than the limit imposed by the filetype.maxtextsize configurable (by default, 10 MB) are assigned filetype text+C and stored in full. Files compressed in the .zip format (including .jar files) are also automatically detected and assigned the type ubinary. Other binary revisions are stored in full, with compression.

(Files in unicode environments are detected differently; for details, see the Internationalization Notes.)

Perforce administrators can use the type mapping feature (p4 typemap) to override Perforce’s default file type detection mechanism. This feature is useful for binary file formats (such as Adobe PDF, or Rich Text Format) where files can start with large portions of ASCII text, and might otherwise be mistaken for text files.

Perforce administrators can use the filesys.binaryscan and filetype.maxtextsize configurables (see p4 configure) to change the default limits of 65536 bytes for text/binary detection, and the 10 MB RCS text file size limit respectively.