This chapter describes how to perform Perforce source code control tasks in the Visual C++ 6.0 environment. It assumes the Perforce SCC Plug-in is installed and that your client machine can communicate with the Perforce server.
When you configure Visual C++ with the Perforce SCC Plug-in, the settings are specific to the project you are working on, so no overall Perforce configuration is required. The Perforce SCC Plug-in retains project settings from session to session and it is not necessary to re-enter them. For details about configuring settings, see
Configuring IDEs with plug-ins.
Visual C++ has a toolbar: to enable it, right-click the toolbar and check on the pop-up menu. To specify source control options, choose Tools> Options... and
When you create a project you intend to manage with Perforce, specify a location that resides within the root folder of the Perforce workspace you intend to use as illustrated in the following figure.
2.
|
On the dialog, specify Perforce settings as follows:
|
•
|
Server: the name of the host computer running the Perforce server in which you want to store the project.
|
•
|
Port: the port number on which the specified Perforce Server accepts commands.
|
•
|
User: the Perforce user name you want associated with the version management operations you perform on the project. To choose from a list of users defined for the specified server, click .
|
•
|
Workspace: the workspace you want associated with the version management operations you perform on the project. You must save the project in a folder under the workspace root. To choose from a list of workspaces defined for the specified server, click .
|
3.
|
Click OK to save settings and dismiss the dialog. The dialog is displayed, listing the files to be added.
|
4.
|
Click to dismiss the dialog.
|
When you open a project that you have placed under Perforce control, Visual C++ attempts to connect to the Perforce server that you configured. If Visual C++ can not connect to Perforce, it asks you whether it should try to connect in future sessions. Choose . If you choose , Visual C++ assumes the project is no longer under version control, requiring you to add it again. If you try to add the project again, Perforce returns an error indicating that the project is already under source control, and you must retrieve the project from the depot.
2.
|
Choose The dialog is displayed.
|
2.
|
Choose The dialog is displayed.
|
3.
|
Click Dismiss the "Advanced sync dialog..." prompt by clicking , then click on the dialog. The dialog is displayed as shown in the following figure.
|
Before you check a file out, be sure you have retrieved the latest revision of the file. (If you check out a file for which the depot contains later revisions, you will be required to resolve it when you check it in.)
After editing the open files, you can save them to your local directory and check the files into the depot. To save the files on your local directory, choose . Note that saving does not update the depot.
To make your changes available to others working on the project, you must check your edited files into the depot. If the changes are accepted, your files become the most recent (or
head) revisions in the depot. If any of the changes conflict with changes previously submitted by another user, the check-in fails and the differences must be resolved using Perforce. To minimize the complexity of merges, check in small sets of changes frequently.
2.
|
Click . The form is displayed.
|
To view all your pending changelists, click the button on the form. P4SCC displays a dialog listing your pending changelists. In this dialog, you can move files among changelists by dragging and dropping them.
If you encounter conflicts when checking in files, (for example, from multiple users working on the same files,) you must resolve the conflicts before you can submit the files. For example, if you and another user have changed the same file and the other user checked in changes before you, when you attempt to check in your changes, Perforce notifies you that resolution is required by displaying the following message in the dialog:
•
|
Accept Merge: merge both files and accept the result, including both the changes you made and the changes made by other users.
|
•
|
Accept Yours: check your changes in, overwriting the most recently checked-in version.
|
•
|
Accept Theirs: discard your changes and preserve the other user's changes.
|
•
|
Run Merge Tool: launch the merge utility so you can view the differences between your version and the most recently checked-in version. Using the merge utility, you can select individual passages or enter new changes to create the final version that you check in.
|
To discard any changes you have made to a file after checking it out, right-click the file and choose . The head revision from the depot is copied to your client workspace, overwriting any changes you have made. Using Perforce, you can verify that the file is removed from the pending default changelist.
Visual C++ displays a file status icon next to each file in the project window. In addition, the Source Control menu is context-sensitive: if you highlight a file, the menu selections are enabled or disabled depending on file status. You can use the icon or menu appearance to identify file status.
Do not put IDE-generated files (such as .ncb,
.clw and
.opt files) in your Perforce depot. If you put the
.ncb file under Perforce control, it is marked read-only when it's not checked out. If the
.ncb file is read-only, class view information in VC++ is disabled.
If you intend to put the workspace file (.dsw) under Perforce control and multiple developers work on the same project, use relative paths to specify file locations to ensure that the entries in the workspace file work correctly on different client computers.
The FileView window displays source file names and their location on your local directory, but is only an approximate representation. Although the display simplifies project development in Visual C++, it differs from the actual file structure as follows:
For some source control tasks, you need to specify the names and locations of these files. To view this information, right-click on the file and choose . The
Source File Properties dialog is displayed. The
General properties option displays the complete file name and path.
Copyright 2001-2012 Perforce Software.