Migrating from Perforce
Migrate projects from Perforce to Unity Version Control.
Read time 5 minutesLast updated 21 days ago
Unity Version Control (UVCS) lets you migrate, and keep synchronized, a Perforce (P4) repository. The P4 Sync command can import metadata, data, and P4 branches in a bidirectional way.
Workflow
The P4Sync command seeks new P4 changesets to import into UVCS, and vice versa. It scans the repositories for missing UVCS changesets to import into P4. When the search operation finds new changesets or changelists, the process synchronizes them. You can use the same command to synchronize the data bidirectionally between the two version control systems, P4 and UVCS. You don't need to change the command syntax to pull from P4 or pull from UVCS; both operations take place simultaneously. By default, when you run the sync command for the first time, all the P4 history for the given depot path syncs into the empty UVCS repository. The first P4 changelist is usually the most challenging, as many assets are typically added at the beginning of the P4 repository. Don't worry if you see the command stop at a changelist; it likely contains numerous changes, and the importer is processing it. The sync command provides periodic updates on the ongoing process. You can enable thecmcm logCLI Usage
cm sync <repspec> p4multibranch <p4server> [--mainbranch=main_branch_folder] [--branchesfolder=branches_folder] --user=usr_name --pwd=password
Options
Option / Argument | Description |
|---|---|
| The UVCS repository you want to syncronize with P4 data. |
| The P4 server address. It should also include the P4 server port. |
| Location for the temporal p4 workspace. |
| Path to a file containing a list of branches you want to avoid pushing to P4. The file format is one UVCS branch per line. The branch prefix (Example: |
| Path to a file containing a list of P4 branches you want to avoid pulling. The file format is one P4 branch (absolute depot path) per line. Example: |
| Path to a file containing a list of P4 files/folders to skip during the pull. The file format is one P4 path (relative path, it applies to all branches) per line. Example: |
| P4 arbitrarily uses different cases for the same path in its history, so you might have log history entries for |
| You can use the |
| Don't stop the process if the P4 commands are failing. |
| Specify the first P4 changelist to import. |
| Specify the last P4 changelist you want to import. |
| You can push changesets from UVCS to Perforce with a Perforce user without |
| It adds UVCS changeset information to the P4 changeslist created while pushing into P4. |
| Use this option to customize a separator for the comments added automatically by UVCS (e.g.: when |
| Number of threads used to download data from the P4 server. |
Import example
Given the P4 repository structure below, where//depot/project/dev//depot/project/release-01//depot/project/release-02//depot/project/dev//depot/project/release-01//depot/project/release-02
If you don't want to import the P4 branches, do not specify thecm sync MyRepoName@catacroquer@cloud p4multibranch p4Server:1666 --mainbranch=//depot/project/dev --branchesfolder=//depot/project --user=p4_read_user --pwd=password
--branchesfolder=Recommentations
Moving a P4 repository involves a lot of data. The process might hit the overall machine performance by flooding the TMP directory. We recommend using the-tmpwkpath--first--excludedcm sync p4multibranchp4--caseinsensitiveLimitations
The branches are always created in UVCS using the full content of the starting point. If only a subdirectory of//depot/project/main/...@24//depot/project/main/...net.parallel.maxnet.parallel.maxnet.parallel.threads--p4threads=XKnown Issues - Pull
The sync operation ignores the P4 changelists that contain changes of different branches (or what we consider different branch folders) in the same changelist. When the P4 changelist used to create the branch (populate/integrate commands) only contains delete operations, we don’t use it as the branch base. In this scenario, we use the closest parent changelist with any change different than a delete as the starting point. The CLI progress while pulling content from P4 might display inconsistent data. For example, if the P4 depot contains 500 changelists, the CLI will display 500 changelist to pull. But the import might affect only 200 changelist, and then the 500 count is inaccurate. This works this way to avoid requesting all the P4 changelists at once at the beginning because it can be slow and error-prone. The sync operation can display there are new P4 changelists to pull, although it later pulls nothing. This happens if these changeslist were pushed from UVCS before or if new changelists in the depot apply to paths unrelated to what's being synchronized. The sync operation can leave some empty directories in UVCS. This is because p4 is not capable of versioning directories, so when all the content of a directory is removed the directory is left empty.Known Issues - Push
The sync report might show some skipped changes for the following reason:The path couldn't be deleted