File types

P4 Server supports a set of Base filetypes. File type modifiers are then applied to the base types allowing for support of RCS keyword expansion, file compression, and more.

When adding files, P4 Server:

  • 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, which you can modify with the p4 typemap command.
  • If a match is not found, P4 Server examines the first bytes of the file based on the filetype.maxtextsize configurable to determine whether it is text or binary. 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 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. To learn more, see the Internationalization Notes.

P4 Server administrators can use the

  • Type mapping feature (p4 typemap) to override the 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.
  • filesys.binaryscan and filetype.maxtextsize configurables (see p4 configure) to change the default limits for text/binary detection and the RCS text file size limit.