About P4 for Visual Studio

P4 for Visual Studio, the P4 for Visual Studio, enables you to use P4 Server for source control from within Visual Studio.

Basic P4 Server Terminology

  • Depot: The shared repository where file revisions are stored and managed by P4 Server.
  • Workspace: The area on your computer where you work with your copies of files that are under P4 Server control.
  • P4 Server: P4 Server, the application that manages file revisions.
  • Changelist: A group of files, with a description explaining how you have changed them (for example, Fix bug #123). Changelists are assigned numbers by P4 Server so you can track them. Changelists enable you to group related files and submit them together.

The following diagram shows the relationship between workspace and depot:

The relationship between a workspace and a depot

Basic Tasks

  • Get revision: Retrieve a copy of a file version from the depot. P4 Server also uses the term sync to mean get revision.
  • Check out: Enables you to change the file.
  • Mark for add or delete: indicates that the file is added to or deleted from the depot when the changelist is submitted.
  • Revert a file: Discard any changes you have made to an open file. If you open a file for edit and make changes, then change your mind and revert the file, P4 Server reloads the last version you got from the depot and discards your changes.
  • Submit a changelist: Update the depot to reflect any changes you have made to files in the changelist. Submitting is an all-or-nothing operation: if there is a problem submitting one file in a changelist, none of the other files in the changelist are updated.

Use Solution Explorer with P4 for Visual Studio

Solution Explorer provides access to most P4 for Visual Studio functionality and status information.

  • When you right-click a file in Solution Explorer, all P4 for Visual Studio actions enabled for that file are available for selection in the context menu.
  • Badges on file icons indicate P4 Server status:

Right-click a file and select Refresh in the context menu to refresh P4 Server status information for the file and any of its children.

If you select Automatically update files status when selection changes in the P4 for Visual Studio Preferences, the file’s P4 Server status updates automatically when you click or hover over the file icon, without having to click Refresh.

Use P4 for Visual Studio toolbars in Visual Studio

P4 for Visual Studio provides the following toolbars that you can use with Visual Studio:

  • The P4 Connection toolbar displays your current P4 Server service connection (hostname:port, workspace, and user), as well as the pending changelist you are working in. If you are not connected to P4 Server, the Connection list shows OFFLINE.
  • The P4 Views toolbar provides access to workspaces, file history, jobs, submitted and pending changelists, labels, and streams.
  • The P4 for Visual Studio toolbar provides the same menu of P4 for Visual Studio options as the Solution Explorer context menu.

To enable these toolbars, select View > Toolbars.

To enable these toolbars and customize them to show only a subset of the available options, select Tools > Customize.

To learn more

Watch the video tutorial on Plugin for Visual Studio.