Fetching and Pushing

Fetching and pushing are the basis of a collaborative distributed workflow and enable users to:

  • Copy changelists from a personal server to a shared server
  • Fetch changelists from a shared server that were pushed there by other personal servers
  • Obtain and work with a subset of a shared server’s entire repository.
  • Copy work between two personal servers

Administrators can also use fetching and pushing to copy changelists between shared servers.

Fetch and push are to the distributed versioning model what sync and submit are to the central server model of Helix Core Server.

Clone and fetch are supported by all replica types, such as readonly, build farm, forwarding replica, edge server, workspace server, standby, forwarding standby. All forwarding replica types (edge, forwarding, forwarding-standby, workspace) support push by automatically forwarding the push to the commit server. Replicas of type readonly, build farm, and standby refuse push.

The p4 fetch command copies the specified set of files and their history from a remote server into a local server. The p4 push command copies the specified set of files, and their history from a local server to a remote server. Both commands are atomic: either all the specified files are fetched or pushed or none of them are.

If a p4 push command fails after it has begun transferring files to the remote server, it will leave those files locked on the remote server. The p4 opened command will display locked, and the files cannot be submitted by any other user. If the p4 push command cannot be quickly retried, you can use the p4 unlock -r command to unlock the files on the remote server.

The p4 push command is not allowed if there are unsubmitted changes in the server from which you’re pushing. Use p4 resubmit to resubmit those changes first, or discard the shelves with p4 shelve -d if they are not wanted. For more information on p4 unsubmit and p4 resubmit, see the example at Resolve conflicts by rewriting local history.

To monitor the progress of the fetch or push, pass the -I option to the command:

p4 -I fetchp4 -I push