Create a remote
Remotes are described by remote specifications or remote specs for short. To
create a remote, run the p4 remote
command. This puts the remote
specification or spec into a temporary file and invokes the editor configured
by the environment variable P4EDITOR
. You then edit the file to specify depot
mappings and other information. Saving the file creates the remote spec.
To modify the remote, invoke p4 remote
with the remoteID
of the remote you
want to modify; make changes in the editor to the remote spec and then save the
file.
Example
In the following example, we get a list of remotes from a shared server, clone
from the shared server using one of those remotes, show the resulting remote in
the personal server — with the p4 remotes
command — and then demonstrate
that the path listed in the remote spec corresponds to the path passed to the
clone command:
-
First, we query a shared server for a list of remotes:
$ p4 -p perforce:1666 remotes bpendleton-dev 'To clone bpendleton's dev branch, use this remote spec. ' h_dev localhost:1666 'Created by hmackiernan. ' markm-remote2 'Created by markm. ' mw-dvcs localhost:1666 '[dvcs] Map main server components. Created by mwittenberg. ' p4-client localhost:1666 'Created by cmclouth. '
-
Then we choose a remote and pass it to the clone command:
$ p4 clone -p perforce:1666 -r markm-remote2 Helix db files in '/Users/jschaffer/.p4root' will be created if missing... Helix Versioning Engine info: Server initialized and ready to use. Remote origin saved. main Changes were successfully fetched. Remote origin saved. Server jschaffer-dvcs-1422657971 saved.
-
Next we run
p4 remotes
against the personal server to show that we now have a remote called "origin," which is the renamed remote we cloned from the shared server:$ p4 remotes origin perforce:1666 'Description '
-
Next, we write the contents of the remote we passed to
p4 clone
to standard output to show the depot paths it specified in theDepotMap
field:$ p4 -p perforce:1666 remote -o markm-remote2 # A Helix Remote Specification. # # RemoteID: The remote identifier. # Address: The P4PORT used by the shared server. # Owner: The user who created this remote. # RemoteUser: The user to use when connecting to the shared server. # Options: Remote options: [un]locked, [no]compress. # Update: The date this specification was last modified. # Access: The date of the last 'push/fetch' on this remote. # Description: A short description of the shared server (optional). # LastFetch: The last changelist that was fetched. # LastPush: The last changelist that was pushed. # DepotMap: Lines to map local files to remote files. # ArchiveLimits: Limits on the number of files fetched (optional). RemoteID: markm-remote2 Owner: markm Options: unlocked compress Update: 2014/12/11 11:15:15 Description: Created by markm. LastFetch: default LastPush: default DepotMap: //depot/main/p4/msgs/... //depot/main/p4/msgs/...
-
Finally, we write the contents of the origin remote spec to standard out to demonstrate that the depot paths it specifies in the
DepotMap
field are identical to those ofmarkm-remote2
:$ p4 remote -o origin # A Helix Remote Specification. # # RemoteID: The remote identifier. # Address: The P4PORT used by the shared server. # Owner: The user who created this remote. # Options: Remote options: [un]locked, [no]compress. # Update: The date this specification was last modified. # Access: The date of the last 'push/fetch' on this remote. # Description: A short description of the shared server (optional). # LastFetch: The last changelist that was fetched. # LastPush: The last changelist that was pushed. # DepotMap: Lines to map local files to remote files. RemoteID: origin Address: perforce:1666 Owner: jschaffer Options: unlocked nocompress Update: 2015/01/30 14:46:51 Description: Description LastFetch: 996270 LastPush: 4024 DepotMap: //depot/main/p4/msgs/... //depot/main/p4/msgs/...
Notice that the
LastFetch
andLastPush
values have changed to non-zero numbers to reflect the highest changelist numbers most recently fetched and pushed.
A closer look at a remote spec
The following is a sample remote spec, describing a remote named
server-main-darwin
:
# A Helix Remote Specification. RemoteID: server-main-darwin Owner: bruno Options: unlocked compress Update: 2014/11/21 08:21:32 Description: A fairly complete set of the mainline code for the widget, with the test harness limited to the darwin platform. Fetch or clone from this remote spec if you want to build and work with the mainline widget code on a darwin machine. LastFetch: default LastPush: default DepotMap: //stream/main/widget/... //depot/main/widget/... //stream/main/widget-test/server/... //depot/main/widget-test/server/... //stream/main/widget-test/bin/... //depot/main/widget-test/bin/... -//stream/main/widget-test/bin/arch/... //depot/main/widget-test/bin/arch/... //stream/main/widget-test/bin/arch/darwin90x86_64/... //depot/main/widget-test/bin/arch/darwin90x86_64/... //stream/main/widget-doc/code/... //depot/main/widget-doc/code/...
The following table describes the remote spec in more detail:
Entry | Meaning |
---|---|
|
The remote identifier. |
|
The |
|
The user who created this remote. |
|
The |
|
The date this specification was last modified. |
|
The date of the last push or fetch on this remote. |
|
A short description of the shared server (optional). |
|
The last changelist that was fetched. If set to default, means no fetches have yet occurred. |
|
The last changelist that was pushed. If set to default, means no pushes have yet occurred. |
|
The lines to map local files to remote files. The file paths on the left-hand side are on the personal server. The file paths on the right-hand side are on the shared server. |
Remote specs give you the full power of Helix client view syntax. For details, see the section "Defining client workspaces" in the chapter Configuring P4 in the Helix Versioning Engine User Guide. Below is some basic information about creating a remote spec.