Previous Table of Contents Index Next
Perforce 2012.1: P4SCC User's Guide



Chapter 1
About IDEs and plug-ins
Perforce plug-ins enable you to perform basic Perforce versioning tasks from within integrated development environments (IDEs). The Perforce SCC Plug-in is installed when you install Perforce on Windows, and is based on the Microsoft Source Code Control (SCC) API and has been tested with Microsoft Visual C++, Visual Basic, and Visual Studio .NET. For details about supported versions of each IDE, refer to the release notes for the plug-ins..
As of June 2012, the preferred Perforce plug-in for Microsoft Visual Studio is P4VS, The Perforce Plugin for Visual Studio. For more information, see the P4VS User's Guide.
Perforce also offers plug-ins for other development tools, such as Eclipse. See our Web site for details.
Note that the terminology for versioning tasks varies depending on which development environment you are using. The following table compares some common terms.
Other commonly used terms
Add to source control/Perforce
About Perforce
Perforce is an enterprise version management system that is based on a client/server architecture. The main repository (the depot) resides on a central server while the files you work on reside in a workspace on your local machine. You can place some or all of the files in your workspace under source control. When you perform versioning tasks, the files remain in your workspace, and Perforce reads or writes them as required. For example, when you submit a change, Perforce reads the edited files in your workspace and updates the information in the database accordingly. When you issue a Get latest version or refresh command, Perforce transfers files from the depot to your workspace.
The most current revision of the file in the depot is called the head revision. Perforce allows you to check out the head revision or any previous revision of a file. To enforce the IDEs' check-in and check-out procedures, Perforce controls the read-write permissions of files. When files are checked out for edit, their permissions are set to read-write. When files are not checked out, Perforce sets them to read-only.
Perforce submits changed files in groups called changelists. Perforce keeps track of a project's revision history as a sequence of changelists. This approach allows you to reconstruct a project in your workspace as it appeared at any point in its history. Perforce makes changes atomically, meaning that when you submit changes to a group of files, either all of the changed files are accepted simultaneously or none of them are. If conflicts result from multiple users working on the same files, these conflicts must be resolved before Perforce will accept the changes.
Perforce offers a command-line client (P4), a cross-platform GUI (P4V) and a Web-based interface (P4Web). For detailed information about Perforce, refer to the user documentation available on the web at:
http://www.perforce.com/documentation/perforce_technical_documentation
Most IDEs are project-based: they manage a group of files according to the project to which the files belong. However, Perforce manages files with no provisions for specific IDEs' project structure. You must determine which files you need to place into your Perforce depot, depending on the conventions of your IDE and your group development practices.
Tracking changes
When files are added to source control, deleted from source control, or checked out for edit, Perforce adds them to a changelist. The changelist contains the file names, revision numbers, and operations to be performed. Any edits you make to checked out files are kept in your local client workspace until you send the changelist to the depot with a check in or submit command.
The Perforce server tracks changelists by numbering them sequentially. Changelist numbers are displayed in a results window after a change has been submitted.
Handling conflicts
The ability to detect and resolve conflicts is important in team development, when multiple developers are working on the same files. For example, suppose two programmers copy the same file from the depot into their workspaces and each programmer edits the file differently. When the first programmer submits his version of the file to the depot, the file becomes the head revision. When the second programmer tries to submit her changes to the depot, Perforce determines that her changes are based on a previous revision and does not allow the file to be checked in. If the second file were accepted without question, the first programmer's changes would be overwritten.
When Perforce detects a conflict, it requires you to choose the changes to be checked in. When resolving file conflicts, you can use a merge utility to display the differences between two text files, to help you determine how to resolve the conflict. For more details, see the Perforce Command Reference.
File types
Perforce automatically detects whether files placed under source control are text or binary files and stores them accordingly on the server machine. By default, text files are stored in reverse delta format, and binary files are stored in their entirety. The following table lists recommended Perforce file types and attributes for common file types. For details about Perforce file types, refer to Introducing Perforce.
GIF graphic file
HTML file
HTML file
JPEG graphic file
MPEG video file
Adobe PDF file
The Perforce apple file type stores Macintosh files in the depot as a single file containing both the data and resource forks. Pre-2000.1 versions of Perforce stored Macintosh file forks as separate files in the depot. If your depots contain Macintosh files stored in this manner, upgrade the existing files to use the apple format. If you do not convert existing files after you upgrade, Perforce continues to store them using its two-file approach.
Configuring IDEs with plug-ins
Regardless of the IDE you use, you must define a client view, add files to the Perforce depot, and configure your source control settings and preferences. The following sections provide details about these tasks.
Configuring Perforce preferences for Visual Studio IDEs
To configure Perforce preferences, display the settings control panel by choosing the corresponding menu entry:
Visual Studio .NET: Tools > Options > Source Control >SCC Provider and click Advanced...
Visual Basic 6.0: Tools > Perforce > Options and click Advanced...
Visual C++ 6.0: Tools > Options, scroll right and click the Source Control tab and click Advanced...
The following sections describe the Perforce settings you can configure on each tab.
General tab
Specifies whether dates are displayed using the operating system format or the Perforce format.
Logs all commands sent to the Perforce server. To log only user-initiated commands, disable this option.
Enables you to diff files in the depot using drag and drop. To prevent inadvertently launching a diff (if you never use drag-and-drop diffing), disable this feature.
Displays a dialog enabling you to change your mind before reverting files. When you revert an open file, any changes you made are discarded.
Connection tab
Specifies how you want to configure the Perforce server and workspace associated with the solution.
Show the Perforce connection dialog: enables you to specify the settings manu­ally.
Bind to the workspace that matches your Perforce environment settings: uses the settings in effect when you add the project ("global" settings).
If you are adding a solution that contains a large number of projects, choose Bind to the workspace that matches your Perforce environment settings and configure the P4PORT and P4CLIENT settings to specify the server and workspace. If you choose Show the Perforce connection dialog, you must manually enter settings for each project in the solution.
For 2003.2 server and below: if enabled, the plug-in displays a "Remember Password" dialog when prompting you for your password. If disabled, the plug-in prompts you every time the Perforce server requires your password.
For 2004.2 server and above: Enables/disables display of login-related dialogs. Perforce servers that are running in a high security mode can set a session time limit. After the session expires, you are prompted to log in when you attempt another Perforce operation.
Specifies encoding used on client machine when connecting to a Perforce Server that is running in Unicode mode. DO NOT SET unless you know for sure that your server is running in Unicode mode.
Diff tab
Enables you to select the application that is used to diff your files. Optionally enables you to configure different applications for specific file types.
Merge tab
Enables you to select the application that is used to perform three-way merges when you resolve files.
Version tab
This tab displays version information about the Perforce SCC Plug-in.
Font tab
This tab enables you to configure the font used by Perforce merge and Time-lapse View utilities.
Defining the client workspace and view
To set up the Perforce environment, you define a client workspace (a directory on the client machine that contains the project files) and a client workspace view (a mapping of the depot to your client computer). The files in your IDE projects must reside under the client workspace root (the highest-level directory of your client workspace).
Your files can be put under source control only if they are located in the client workspace. Your Perforce workspace root must match the Visual Studio binding root directory, rather than any other subdirectory of this binding root which may in turn contain other Visual Studio projects. You can specify a directory that already contains files, or an empty directory for a project you intend to create. You can also populate your client workspace with files from the depot which are currently under version control.
To create a client workspace and view, you must use the Perforce Command-Line Interface (p4) program. Note that P4SCC does not observe settings in Perforce config files. For details about client workspaces and views, refer to Introducing Perforce.
Add a project to source control
To add a project to source control, you specify the Perforce settings required to connect to the server where you want to store the project. You must specify the following settings:
This setting specifies the name of the host on which the server is running and the port on which the server is listening, using the following format:
1666
1818
Host name (or IP address) and port are required
myhost:1818
mydomain.com:2550
10.0.0.5:1666
Adding files to the depot
After you specify the settings for the server where you want to store project files, you can add the files. The exact commands required to add files to the depot depend on the IDE in which you are working. Typically you perform two steps:
1.
2.
Files are added when the Check In or Submit is completed.
Basic versioning tasks
The plug-ins enable you to perform the following basic versioning from within your IDE:
After you add files to your project, you add them to the depot.
Put your edited files in the depot as the most recent revisions.
Compare a file with a previous revision to see what's changed.
The Perforce diff utility is launched to display differences between two versions of a file.
Discard changes you've made to your local copy of a depot file.
The head revision is synced to your client workspace and removed from its pending changelist.
Note that deleting files is a two-part operation: when you delete a file from the project, the file is physically deleted from the file system and opened for delete in a pending changelist. However, the file remains in the depot until you submit the changelist.
When to go outside the IDE
To perform administrative tasks, you need to use the p4 command line client. For details about performing these tasks, see the Perforce Adminstrator's Guide.
Tasks that require you to work outside the IDE include:
Modifying a client view or user password: you can create a client specification or user through the Connection dialog when adding a project to source control, but to modify it subsequently, you must use another Perforce client program (such as the p4 command line, or P4V).
Creating branches and labels: these and other administrative tasks must be done using the p4 command. Refer to Introducing Perforce for basics.
If use Perforce to version files from outside the IDE, be sure to refresh the IDE display afterwards, to ensure that file status is updated and displayed correctly.


Previous Table of Contents Index Next

Perforce 2012.1: P4SCC User's Guide
Copyright 2001-2012 Perforce Software.