Configuring P4 Server connections and working offline
Defining connections
Connections enable you to browse the P4 Server (P4D) to import projects and obtain access to files under P4 control. You define connections in the P4 Connections view of the P4 perspective. To define a connection, you specify the server host and port, your P4 user name, and the name of the P4 client workspace associated with your Eclipse project.
To define a connection:
- In the P4 perspective's P4 Connections view, right-click and choose New Connection... The P4 Server Connection Wizard is launched. (Alternate menu choice: File > New > Other > P4 > Connection)
- On the first page, enter the connection settings and click Next.
Connection settings: - Server: P4PORT setting (protocol:hostname:port) for the P4 Server (for example ssl:myp4server.example.com:1777)
- Charset: set only if the P4 Server is running in Unicode mode.
- User: your P4 user name
- Password: your P4 password
- On the second page, choose or create a P4 client workspace to be used in association with the specified server. Clear "Launch P4 Import Wizard to import depot folders as Eclipse projects" if you do not want to import the project from the connection.
- Click Finish. Your newly-defined connection is listed in the P4 Connections view.
If P4 AS is configured for your P4 Server a web page will open and you will be directed to the sign in process used by your Identity Provider (IdP).
Workspaces: P4 vs. Eclipse
Both P4 and Eclipse define workspaces, that is, managed directories that contain local copies of files. Eclipse projects that are managed by P4 must reside under the client root directory. To ensure that you do not check in machine-specific Eclipse files (which creates problems for other developers who import your projects), keep the Eclipse and P4 workspaces separate, that is, ensure that neither workspace resides inside the other.
When you create new projects and check them into P4, the final location of the project must be in the P4 workspace. Share Project Wizard can help you move the project intoP4workspace automatically.
The P4 client workspace is configured by editing its client specification. To edit the client specification, right-click the corresponding connection in the P4 Connections view and choose Edit P4 client...
Working offline
Set a connection to Work Offline:
- Go to the P4 perspective.
- Select the connection.
- Right-click on the connection, select Work Offline.
If P4 AS is configured for your P4 Server, setting the connection to Work Offline might not invalidate your Identity Provider (IdP) login status. If you try to set the connection to Work Online while your IdP status is still valid, you will not be prompted to complete the log in steps. To avoid this, log out from your IdP page before setting the connection to Work Offline.
Set a connection to Work Online:
- Go to the P4 perspective.
- Select the offline connection.
- Right-click on the connection, select Work Online.
- To detect files that differ from the depot, select your project in the Navigator pane.
- Right-click the project, select Team > Check Consistency...
If P4 AS is configured for your P4 Server a web page will open and you will be directed to the sign in process used by your Identity Provider (IdP).
P4 Connection Error
If P4 for Eclipse cannot connect to a P4 Server to perform an operation, it displays the following prompt:
To continue with the current connection settings, click Work Offline. If you work offline, you must reconcile any changes you make with the P4 depot when the server connection is restored. You must add newly-created files, check in changed files, and delete files from the depot that you have deleted from the project. To detect files that differ from the depot, right-click the project in the Navigator pane and choose Team > Check Consistency...
If you have chosen to work offline, note that, by default, P4 for Eclipse retries the connection the next time you launch Eclipse. If you expect to work offline for an extended period of time, you can disable the retries (and the resulting error messages) by enabling the Team > P4 preference Retain offline connection state between Eclipse sessions.