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..
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 or 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:
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.
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 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.
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.
|
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.
|
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.
|
|
|
Specifies how you want to configure the Perforce server and workspace associated with the solution.
•
|
enables you to specify the settings manually.
|
•
|
: 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 and configure the P4PORT and P4CLIENT settings to specify the server and workspace. If you choose , 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.
|
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.
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:
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.
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.
•
|
Modifying a client view or user password: you can create a client specification or user through the 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.
|
Copyright 2001-2012 Perforce Software.