Unity Version Control(Plastic SCM) Desktop application Version: 9.0.16.5285 or above
Enable CLI Log
The sync command provides periodic updates on what's happening; for additional information, you can enable the "cm" log file. Click here to learn how.
Summary
This Knowledge base explains how to use P4multibranch sync with parameters. The sync allows exporting changes from Plastic branches to P4 and helps keep changes in sync between Plastic and P4 when both systems are used concurrently. p4multibranch is the best way not only for the repository with a branch but also for a non-branched repository, as it is faster and provides more output.
CLI USAGE
Usage:
cm sync <repspec> p4multibranch <p4server> --mainbranch=<main_branch_folder> --branchesfolder=<branches_folder> --user=<usr_name> --pwd=<password>
Example:
cm sync plastic-repo p4multibranch p4server:1666 --mainbranch=//depot/main --branchesfolder=//depot --user=user --pwd=mypwd
Please note that the command needs to explicitly know which p4 folder matches the main branch and which includes the rest of your branch folders.
Example:
With the following depot structure:
//depot/project/dev //depot/project/release-01 //depot/project/release-02
where //depot/project/dev is the main branch folder and //depot/project/release-01 & //depot/project/release-02 are also branch folders.
The command should receive the following parameters (notice that these depot paths don't end with /...):
--mainbranch=//depot/project/dev --branchesfolder=//depot/project
Optional Parameters
--skipplasticbranches
Use '--skipplasticbranches=path_to_file' to skip Plastic branches during the push. The file format is one branch per line. The branch prefix ("br:") can be omitted.
Example:
/main/Fix-5.4/SCM4767 /semanticmain/ReleaseSMT-0.9.40.0
--skipp4branches
Use '--skipp4branches=path_to_file' to skip P4 branches during the pull. The file format is one P4 branch (absolute depot path) per line.
Example:
//depot/Fix-5.4 //depot/SCM1002
--skipp4paths
Use '--skipp4paths=path_to_file' to skip P4 files/folders during the pull. The file format is one path (relative path, it applies to all branches) per line.
Example:
/lcc/alpha/bin /legal/COPYING.txt
Limitations
- The '--user' parameter is mandatory when pushing changes to a depot of type 'stream'. In this case, all the streams created to push the Plastic branches are created of type mainline.
- The branches are always created in Plastic using the full content of the starting point. This means that if only a subdirectory of
//depot/project/main/...@24is branched in P4, we will see the whole content under//depot/project/main/...in Plastic. - Branches created from custom configurations don't keep this custom configuration in Plastic. A branch always starts from an existing and defined configuration (changeset) in Plastic. So, the importer will choose only one specified path@changelist configuration as the base. Check the 'Branch from different configurations' appendix.
-
net.parallel.max P4The setting must be set to a value higher than 1 to enable parallel download of contents while syncing. Only a superuser can set both variables:net.parallel.maxandnet.parallel.threadsThese values will be used during the sync. You can also force the number of threads to download data from p4 by using the parameter --p4threads=X.
Limitation on Pull
- The sync ignores the changelists that contain changes of different branches (or what we consider different branch folders) in the same changelist.
- The branch starting point is wrongly calculated when the changelist used to create the branch (populate/integrate commands) only contains delete operations. In this scenario, we use the closest parent changelist with any change other than a delete as the starting point.
- The sync operation can say that there are new changelists to pull, although it later pulls nothing. This happens if these changeslist were pushed from Plastic before or if there are new changelists in the depot that apply to paths not related to what's being synchronized.
- The sync operation can leave some empty directories in Plastic. Since p4, doesn't handle directories, when all files are removed, the directory doesn't exist anymore.
Limitation on Push
- The sync report might show some changes skipped due to the following reason: 'The path couldn't be deleted'. This report is harmless, and it will just keep a file loaded in p4 that shouldn't be there (in the worst scenario).
- Perforce does not support reusing a path in the same changelist, so we cannot export these changes from Plastic to Perforce. In these cases, we do our best to keep the same structure on the Perforce side. Check 'Paths reused in the same changelist' appendix.
- The push ignores changes in empty directories since p4 doesn't handle directories at all.