This KB explains the P4 Sync command; the P4 Sync command allows you to migrate a P4 depot path to a Plastic SCM repository.
WORKFLOW
How does the sync work? It's simple. P4Sync seeks new P4 changeselists to import into Plastic SCM and the other way around, it seeks for missing Plastic SCM changesets to be imported into P4, if the search finds new content the process synchronizes it.
The same command is used to bidirectional synchronize the data between the two systems, P4 and Plastic SCM; you don't need to change the command to pull from P4 or pull from Plastic, the two operations take place at the same time.
The first time you run the sync command all the P4 history for the given depot path syncs into the empty Plastic SCM repository. The first p4 changelist is usually the hardest one since a considerable number of assets are probably initially added at the beginning of the P4 repository, don't worry if you see the command stopped at a changelist, it probably contains many changes.
The sync command gives periodic updates about what's going on; for additional information, you can enable the "cm" log file, here you can learn how: https://www.plasticscm.com/documentation/technical-articles/kb-enabling-logging-for-plastic-scm-part-i
CLI USAGE
cm synchronize br:/main@MyRepoName@plastic-server:8087 p4 p4Server:1666 //myDepot/path --user=p4user --pwd=p4password
- "br:/main@MyRepoName@plastic-server:8087": A Plastic SCM main branch specification, using the main branch of the Plastic SCM repo is currently mandatory, that's where the original content of the P4 repository path is pushed.
- "p4": Is just an informative parameter for the command, you specify you want to use the P4 backend.
- "p4Server:1666": The IP/Name and port of the P4 Server.
- "//myDepot/path": The P4 repository path you want to import into the Plastic SCM repository.
- "--user" and "--pwd": Credentials for the P4 Sync server.
PARAMETERS
There is one optional parameter that we do recommend you to use, it's the "--tmpwkpath", use it to specify a custom path for the temporal p4 workspace, that is where P4Sync downloads the p4 depot files, we recommend to use: "--tmpwkpath=c:\p4wks", it gives you enough room for long path names and you avoid overpopulating your windows temp directory (which affects the command performance). Don't forget to use it.
Related to the performance bottlenecks, we recommend redefining the system "TMP" variable path for the terminal running the "cm sync p4" command, the sync command creates a lot of temporal files, and it's better to have a custom path for it.
Some other parameters that might be useful too:
- "--caseinsensitive": P4 arbitrarily use different cases for the same path so you might have log history entries for "/Assets" and "/assets". Without this parameter, both paths are different items inside Plastic as the Plastic SCM server is case sensitive.
- "--excluded": You can use the "--excluded=excludeFilePath" parameter to target a configuration file containing P4 depot path rules to ignore during the migration.
For example, if you want to sync the "//depot/stream" P4 depot path but you are not interested in migrating the "//depot/stream/subdirtoexclude" subdirectory then the config file must have "/subdirtoexclude" written in order to ignore it, as you can see it's a relative path to the root sync path. - "--continueonp4error": Don't stop the process if the P4 commands are failing.
- "--last=": you can use it to specify the last P4 changelist you want to import and once it's done repeat the command to specify a highest one in an incremental way. This parameter is very interesting when the depot has a huge number of changelists, performing several and smaller imports reduce the risk.
- "--bypassmetadatatocomment": it is possible to push changesets from PlasticSCM to Perforce with a Perforce user that hasn't got 'admin' or 'super' privileges. However, the owner and the date of the PlasticSCM changeset are written on the Perforce changelist comment, instead of the "Owner" and "Date" properties of the Perforce change object.
- "--traceinfo": It adds Plastic SCM changeset information to the P4 changeslist created while pushing into P4.
- "--commentseparator" option used to customize a separator for the comments added automatically by Plastic (e.g.: when --traceinfo option is set). If "--commentseparator" is not specified the default separator P4Sync uses a couple of new lines.
LIMITATIONS
- The P4 sync command only works in Windows.
- You can only migrate one P4 path into a Plastic SCM repository.
- P4 integrate operations are not supported.