Define filetypes with p4 typemap
Helix Core Server
uses the filesys.binaryscan
configurable to determine how
many bytes to examine when determining if a file is of type
text
or binary
. By default,
filesys.binaryscan
is 65536. If the high bit is clear in the
first 65536 bytes,
Helix Core Server
assumes it to be text
. Otherwise, it is assumed to be
binary
.
Files compressed in the .zip
format, including .jar
files, are also automatically detected and
assigned the type ubinary
.
This default behavior can be overridden with the
-t filetype
flag. Users might overlook
this consideration where filetypes are usually
detected correctly. For example, RTF
(Rich Text Format) and Adobe PDF (Portable Document Format) can start
with a series of comment fields or other textual data. If these comments
are sufficiently long, such files can be erroneously detected by
Helix Core Server
as being of type text
.
The p4 typemap
command enables you to set up a table that links
Helix Core Server
file types with filename specifications. If an entry in the typemap table
matches a file being added, it overrides the file type that would
otherwise be assigned by the
Helix Core Server
application. For example, to treat all PDF and RTF files as
binary
, use p4 typemap
to modify the
typemap table as follows:
Typemap: binary //....pdf binary //....rtf
The first three periods ("...
") in the specification are a
Helix Core Server
wildcard specifying that all files beneath the root directory are to be
included in the mapping. The fourth period and the file extension specify
that the specification applies to files ending in .pdf
(or
.rtf
).
Consider these Helix Core Server file types and modifiers for common file extensions:
File type | Helix Core Server file type | Description |
---|---|---|
|
|
Active server page file. |
|
|
Video for Windows file. |
|
|
Windows bitmap file. |
|
|
Btrieve database file. |
|
|
Conference link file. |
|
|
Cascading style sheet file. |
|
|
Microsoft Word document. |
|
|
Microsoft Word template. |
|
|
Export file or Microsoft Visual C++ |
|
|
GIF graphic file. |
|
|
Gzip compressed file. |
|
|
HTML file. |
|
|
HTML file. |
|
|
Icon file. |
|
|
Active Server include file. |
|
|
Initial application settings file. |
|
|
JPEG graphic file. |
|
|
JavaScript language source code file. |
|
|
Library file. |
|
|
Log file. |
|
|
MPEG video file. |
|
|
Adobe PDF file. |
|
|
SAP Power Designer file. |
|
|
Microsoft PowerPoint file. |
|
|
Unity3D file. |
|
|
Microsoft Excel file. |
Use the following p4 typemap
table to map all of the
file extensions to the
Helix Core Server
file types recommended in the preceding table.
# Perforce File Type Mapping Specifications. # # TypeMap: a list of filetype mappings; one per line. # Each line has two elements: # Filetype: The filetype to use on 'p4 add'. # Path: File pattern which will use this filetype. # See 'p4 help typemap' for more information. TypeMap: text //....asp binary+F //....avi binary //....bmp binary //....btr text //....cnf text //....css binary //....docx binary //....dotx binary+w //....exp binary+F //....gif binary+F //....gz text //....htm text //....html binary //....ico text //....inc text+w //....ini binary //....jpg text //....js binary+w //....lib text+w //....log binary+F //....mpg binary //....pdf text+w //....pdm binary //....ppt binary //....xlsx
If a file type requires the use of more than one file type modifier,
specify the modifiers consecutively. For example,
binary+lFS10
refers to a binary
file with
exclusive-open (l
), stored in full (F
) rather
than compressed, and for which only the most recent ten revisions are
stored (S10
).
For learn more, see the p4 typemap
page in the
Helix Core Command-Line (P4) Reference.