Version: 2025.2 — Supports Perforce servers up to and including 2025.2. For newer servers, contact Helix Core Support to confirm compatibility.
p4migrate helps Perforce Administrators produce a case-consistent checkpoint and optionally rename archive files so you can move servers between platforms and case modes safely. It uses a two-pass workflow with conflict maps (cmap, cmap2): first pass discovers case conflicts and generates cmap (report-only). You edit only the right-hand side (RHS) of cmap to choose preferred casing. Second pass applies your choices, writes an edited checkpoint, and appends any unresolved conflicts to cmap2.
| Source OS | Target OS | Target Case Mode | Recommended Approach |
|---|---|---|---|
| Windows/macOS (case-insensitive) | Unix/Linux (case-sensitive) | Case-sensitive | Use p4migrate (discover and fix case conflicts; rename archives) |
| Windows/macOS | Unix/Linux | Case-insensitive | Use p4d -C1. p4migrate typically not required for case-insensitive targets |
| Unix/Linux (case-sensitive) | Windows/macOS (case-insensitive) | Case-insensitive | Use p4d -C1. Review archive naming; p4migrate is optional |
| Unix/Linux | Unix/Linux | Same case mode | No p4migrate needed |
| Windows/macOS | Windows/macOS | Same case mode | No p4migrate needed |
Backups and Testing: Always back up your server root and archives. Test on a non-production environment before applying changes.
p4migrate -y -c cmap checkpoint.1
Review cmap and edit only the RHS case to your preferred casing.
p4migrate -y -t cmap -c cmap2 -o checkpoint.edited checkpoint.1
If cmap2 shows appended entries, fix your map (usually missing parent mappings or illegal edits), then rerun.
Typical: Windows or macOS → Linux with a case-sensitive target. The checkpoint may contain case variants referring to the same logical item on case-insensitive platforms. p4migrate discovers these and creates a conflict map. You select the preferred casing (RHS). Second pass applies the changes and produces an edited checkpoint. If archives were written in lowercase or inconsistent casing, use the rename phase to align archive paths with the edited checkpoint.
Typical: Linux → Windows or macOS, or Linux with a case-insensitive target. Prefer p4d -C1 to switch case mode; p4migrate is generally not required to fix case since a case-insensitive server treats variants equivalently. Still review archive naming and paths for consistency. If you do use p4migrate for hygiene, follow the same two-pass workflow to standardize casing before the transition.
//depot/Main/... //depot/main/...
//ACESFoxpro/... //acesfoxpro/...
//Conversion/... //conversion/...
Invalid:
//depot/Main/... //depot/main # Missing /...
//project/... //proj/... # Not a case-only change
Suppose the generated conflict map includes a mapping for a leaf directory where the conflict occurred:
//depot/QA/Gastar/... //depot/QA/Gastar/...
You edit the map to change the case of both the parent directory (QA) and the leaf directory (Gastar):
//depot/QA/Gastar/... //depot/qa/gastar/...
In this case, you must also add a new mapping for the parent directory to avoid introducing a new conflict for other //depot/QA/... paths outside the Gastar subdirectory:
//depot/QA/... //depot/qa/...
//depot/QA/Gastar/... //depot/qa/gastar/...
On Windows servers (2000.2+), archive directories/files may be stored in lowercase; on case-sensitive targets, archives must match the edited checkpoint paths exactly. Use p4migrate’s rename phase to correct archive casing and verify with sample file retrieval.
After producing checkpoint.edited with your preferred casing, you must ensure that the archive file and directory names match the casing of paths in the checkpoint. On case-sensitive targets, mismatched archive names will prevent file retrieval.
Important: Back up your archive tree before renaming. Perform the rename in a maintenance window with the server stopped.
# 1) Stop the server
p4 admin stop
# 2) Apply edited checkpoint (on the target server root)
p4d -r /path/to/p4root -jr checkpoint.edited
# 3) Rename archives to match the edited checkpoint casing using p4migrate
# -R performs archive rename. -r supplies P4ROOT. -S may be required for server.depot.root configurations.
p4migrate -y -R -r /path/to/p4root -S MyServerId -t cmap -o checkpoint.edited checkpoint.1
# 4) Restart the server
p4d -r /path/to/p4root -p 1666
For Windows/macOS (case-insensitive) sources moving to case-sensitive targets, archive renaming is commonly required because archives may be stored in lowercase or mixed case. For case-insensitive targets (p4d -C1), archive renaming is usually not necessary but consistency is still recommended.
p4migrate -y -c cmap checkpoint
Open cmap, adjust only the RHS casing; sort parent-before-child for readability.
p4migrate -y -t cmap -c cmap2 -o checkpoint.edited checkpoint
Rename archive directories/files to match the edited checkpoint casing (case-sensitive platforms):
# Provide P4ROOT and, if required, ServerId
p4migrate -y -R -r /path/to/p4root -S MyServerId -t cmap -o checkpoint.edited checkpoint
Complete command-line usage for p4migrate:
Usage: p4migrate [options] <checkpoint file>
where options are:
-c <filename> - Filename to use for the output translation map,
also known as the 'conflict map'.
Conflicts in your checkpoint are recorded in this
file by generated mappings from the lowercase
variant of the filename to the most frequently
observed variant in your checkpoint. You should
edit this file and change the mappings to meet
your requirements and then supply the edited file
as the input translation map using the -t flag.
-C0 - Generate a case sensitive checkpoint (default)
-C1 - Generate a case insensitive checkpoint
-j - Produce the output as a journal patch rather
than a replacement checkpoint.
-l <filename> - Filename to use for logfile. Defaults to stderr.
-L <locale> - The locale to use during the migration.
Not used if the source checkpoint is from a 'unicode' server.
The 'C' locale is set by default, and is the fastest for migrating,
but will not support case folding of multi-byte characters.
Any other locale may be specified, but it may slow down processing,
and will require that the specified locale is installed on the machine.
If the locale specified contains the string 'UTF-8' then utf8
case folding will be enabled.
-o <filename> - Filename to use for the output checkpoint.
After mapping records through the input translation
map, the edited records are written out to this
file. If no further conflicts remain, then this is
a case-consistent checkpoint. If conflicts remain
unresolved then this checkpoint should not be used
rebuild your database. You may pass '-' to use
stdout.
-p <policy> - Name of a built-in policy to apply. Valid policies
are:
lower - convert all paths to lowercase
upper - convert all paths to uppercase
head - convert all paths to the variant used
by the head revision
Note: The values for upper and lowercase characters
are very dependent on your locale. If your
checkpoint contains characters in different
character sets you should exercise great care with
the use of this option.
In particular, you should run 'p4 verify -q //...'
and check the output very carefully.
Note 2: Policies are applied before the translation
map, so you may override the policy for specific
paths using the translation map. You will likely
need several mappings to get this right. e.g.
with a policy of 'upper' you might use something
like this:
//depot/... //Depot/...
//depot/main/... //Depot/Main/...
//depot/main/www/... //Depot/Main/www/...
i.e. a mapping for every part of the tree that
you want to exempt from the policy
-R - Attempt to rename the archive files to match the
case in the translated checkpoint. This option
is only available on case-sensitive platforms.
-r <p4root> - Your P4ROOT directory, this option may be needed if -R is used,
and the server.depot.root configurable is not found.
-s - Will convert the input checkpoint to
'standard checkpoint' format.
-S <serverId> - The ServerId for this server, this may be required when
server.depot.root configurable is found.
-t <filename> - Filename for the input translation map.
The paths in your checkpoint are remapped through
the mappings in this file to resolve conflicts
due to inconsistent use of case. Default: none
See also -c.
-u - Source checkpoint is from unicode mode server.
This option is only needed if the checkpoint is missing a
Checkpoint header journal note.
-v <level> - Output verbosity, (0-6) higher levels provide more detail
-V - Print version details and exit.
Windows and macOS are generally case-insensitive; Unix/Linux are case-sensitive. Case variants that refer to the same logical item on Windows/macOS become distinct on Unix/Linux. The recommended flow:
Prefer switching the target server to case-insensitive mode using p4d -C1. p4migrate is typically not required to fix case since case-insensitive servers treat variants equivalently. Still ensure archive paths are consistent, and consider using the two-pass workflow to standardize casing prior to the transition.
When moving across platforms, line endings in archive files may need adjustment for text content. Recommended:
p4migrate has 3 locale based configurations, configured by the -L locale setting
If the checkpoint is from a unicode mode server then utf8 specific case folding will be used.
if no -L locale option is passed, the 'C' locale will be used by default
There is a chance, that for a given locale setting, p4migrate will miss some case folding conversions. If this happens, multiple permutations of a given case insensitive path may still exist in the resulting checkpoint. You may wish to try the migration again using a different locale setting to see if it works better.
Policies can be used to apply a global transformation to all paths in your repository. If it's your policy that all filenames should be lower- or upper-case, then p4migrate can correct all exceptions to this policy and bring all your pathnames into line.
p4migrate -p upper -c conflicts -o checkpoint.new checkpoint.NNNN p4migrate -p lower -c conflicts -o checkpoint.new checkpoint.NNNN
There's also a policy called 'head' which will not transform the paths in any way, but rather affects the path that will be chosen for inclusion in the conflict map. Instead of choosing the most frequently-used case-variant, it will select the case used by the head revision (in the case of conflicts) at the filename level and, for conflicts at the folder level, it will choose the most recently encountered variant used by the head revisions of the files underneath that folder.
p4migrate -p head -c conflicts -o checkpoint.new checkpoint.NNNN
There are some caveats with the use of policies:
You can override your policy using the Translation Map (-t transmap) to specify the exceptions to the rule as the Translation Map is applied after the policy. When you do this, ensure that you provide a complete set of mappings and use the -c flag with p4migrate so that any conflicts (perhaps caused by missing mappings) are recorded in a conflicts map so that you can correct your translation map and try again. For example:
p4migrate -p upper -c conflicts -t transmap -o checkpoint.new checkpoint.NNNN
Note, using this feature you will need to confirm that you have understood that this can casue unexpected results if applied incorrectly.
The "Translation Map" is in the same format of the conflict maps. Any path that is mentioned in the the Translation Map will be applied after the policy. In the above the policy is "upper". If the Translation Map contains:
//depot/production/... //DEPOT/production/...
//depot/production/gastar/... //DEPOT/production/gastar/...
The the paths starting with "//DEPOT/production/..." and "//DEPOT/production/gastar/..." will all be in lower case matching the translation map, and all other depot will be in upper case Matching the policy, upper. For example, your final depot layout would appear as:
//DEPOT/FOO.TXT
//DEPOT/DEV/FOO.TXT
//DEPOT/production/LIVE/FOO.TXT
//DEPOT/production/gastar/QA/FOO.TXT
Applying policies and Translation Maps at the same time can lead to unexpected results if applied incorectly. If in doubt, contact Perforce Technical Support for assistance.
Advanced mode caution: mixing policies and translation maps can be powerful but risky. Ensure your maps are case-only on RHS, parent-first, and consistent across the hierarchy.
Contact P4 Support or visit Perforce Technical Support for assistance.