Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

C/C++ API Documentation | 2025.1

# ServerHelperApi::PrepareToCloneRemote(ServerHelperApi*,const char*,ClientUser*,Error*)

Creates a remote specification based on the provided remote from the shared server.

Virtual? | No |
Class | `ServerHelperApi` |
Arguments | `ServerHelperApi *remote` | ServerHelperApi object representing the shared server
| `const char *remote` | name of remote spec on shared server
| `Error *e` | a pointer to an Error object
Returns | `int` | returns 1 if successful

## Notes

This creates a new remote spec based on the provided remote spec stored on the shared server. It also checks that `p4 fetch` is allowed on the remote server specified.

## See also

`ServerHelperApi::PrepareToCloneFilepath()`

## Example

    ServerHelperApi remoteServer( &e );
    remoteServer.SetPort( "1666" );
    remoteServer.SetProg( "MyApp" ); // optional
    remoteServer.SetVersion( "1.0" ); // optional

    // Copy the remote spec from the shared server
    if( !localServer.PrepareToCloneFilepath( &remoteServer, remote, &ui ) )
        return 0;

    // Create the local server
    // This returns the exit code from p4d, so 0 is success
    if( localServer.InitLocalServer( &ui ) )
        return 0;

    // Fetch from the remote
    if( !localServer.CloneFromRemote( 0, 0, &ui ) )
        return 0;

Your search for returned results