The Perforce sync command is used to synchronize your workspace files with the files in the depot. It uses your client spec to determine which depot files to get and where to put them in your workspace. You can click on your Client name at the top of any screen in P4Web to look at or edit your client spec.
If there are files in the depot that haven't been copied to your workspace, sync will copy them in. If any the depot files have been updated, sync will copy the newer files to your workspace. If you have files in your workspace that have been deleted in the depot, or if you have changed your client mapping so that files you previously synced are no longer in your client view, sync will remove those files from your workspace. If your workspace files are already in sync, the sync command will do nothing.
The "" and "" icons mark workspace files that are in sync with existing and deleted depot files, respectively. The "" icon marks files that are not in sync with head revisions in the depot. If you have "Show entire depot" set, files previously synced but no longer mapped in your client view are marked with "".
If you have files open for edit or integrate, sync will not remove or copy over them. However, you won't be able to submit your open files until you've resolved changes from the newer files in the depot. After you sync open files, they'll be marked with the "" icon to remind you they need to be resolved.
Normally files copied to your workspace by sync are read-only. Use open for edit to make them writable.
There are a couple of ways to run sync in P4Web:
Previewing shows you which files will be updated and where they will be written to your workspace.
"Sync to head revision" shortcut button
The Sync Options page lets you pick from these options before previewing or running the sync command:
- Head revision
- Sync to the head revisions (latest versions). This is the default option.
- Revision number
- Sync to a specific, absolute revision. This is probably only useful when syncing one file. Enter a revision number in the space provided.
- Changelist Number
- Sync to a specific changelist number. Enter the changelist number in the space provided. Syncing to a changelist number gets files that were the head revisions in the depot at the time the changelist was submitted.
- Label or Date
- Sync to a specific symbolic revision revision (either a label or date). This can be used to synchronize your workspace files to something other than the latest files in the depot. Enter the label or date in the space provided.
- Same Revision
- Sync to the same revisions you already have in your workspace. (Unless you also check the "Force" option, this results in a sync command that does nothing.)
- Force
- Check the "force" option if you want sync to get fresh copies of files from the depot even if the Perforce server thinks you already have those files. Use this if you need to replace files removed from your workspace by something other than Perforce.
- Restricting files
- If you came to the Sync Options page with a directory selected, you can restrict the files to be opened.
Regardless of which files you select, a file is only copied to your workspace if:
- The file is not already opened in your workspace
- The file is in your client view
- You have permission to read the file