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:

  1. 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. '
  2. 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.
  3. 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 '
  4. Next, we write the contents of the remote we passed to p4 clone to standard output to show the depot paths it specified in the DepotMap 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/...
  5. 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 of markm-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 and LastPush values have changed to non-zero numbers to reflect the highest changelist numbers most recently fetched and pushed.