Migration using remote specs and p4 fetch/push
The fetch and push commands transfer the all versions of the files in question bidirectionally.
Configuring a server for fetch/push
The fetch and push commands are available on perforce servers version 2015.1 or later. By default the fetch and push commands are disabled in a given server. To enable them the 'p4 configure' command is used:
> p4 configure set server.allowfetch=1
The meaning of the value of the server.allowfetch setting is:
- If set to 1, this server can fetch from other servers
- If set to 2, other servers can fetch from this server
- If set to 3, both 1 and 2 are allowed
> p4 configure set server.allowpush=1
The meaning of the value of the server.allowfetch setting is:
- If set to 1, this server can push to other servers
- If set to 2, other servers can push to this server
- If set to 3, both 1 and 2 are allowed
Data transfer using remote specs
Data transfer between servers is accomplished by defining a remote spec. The remote spec defines the P4PORT of the remote server, and maps the local depot locations to the corresponding remote depot locations.
Defining a remote
Remote specs are configured using the 'p4 remote' command:
> p4 remote myremote
Configuring remotes
If the two servers are named ServerA and ServerB, where ServerA's local shared depot location is '//depot/devA' and ServerB's local shared depot location is '//depot/devB' ServerA's remote definition would look like:
RemoteID: ServerB Address: ServerB:1666 DepotMap: //depot/devA/... //depot/devB/...
Whereas ServerB's remote definition would look like:
RemoteID: ServerA Address: ServerA:1666 DepotMap: //depot/devB/... //depot/devA/...
Note for the 'DepotMap' field the path on the left hand side is on the local server, the path on the right hand side is on the remote server. Multiple paths can be included in the DepotMap, and the paths can be the same on both servers.
Logging into the Remote Server
The remote spec can be used to log into the remote server:
> p4 login ServerA
If the field 'RemoteUser' is defined in the remote spec that user name will be used for the login, otherwise the remote p4 username and the local p4 username must be identical.
Remote Server Permissions
In order to fetch from the remote server the p4 user must have read permission on the remote server path, similarly to push data to the remote the p4 user must have write permission on the remote server path.
Transferring Data from the Remote Server
Once the configuration able is complete the data transfer is initiated with a 'p4 fetch' command.
To fetch all the data on the path specified by the remote (assuming you are doing the fetch from ServerB):
> p4 fetch -r ServerA
See P4 for Distributed Versioning for more information.