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



Chapter 3
This chapter describes how to perform Perforce source code control tasks in the Visual Basic 6.0 environment. It assumes the Perforce SCC Plug-in is installed and that your client machine can communicate with the Perforce server. For details about configuring settings, see Configuring IDEs with plug-ins.
The Perforce submenu lists the version management operations you can perform. Note that the Tools>Perforce>Create Project from Perforce... option is not supported.
If the Add-Ins > Add-In Manager... menu item does not contain Source Code Control in the list box, you do not have the VB Source Code Add-In. For help getting it from Microsoft, contact [email protected].
Configuring Visual Basic with Perforce
Before you can put Visual Projects under Perforce control, verify that source code control is enabled, as follows:
1.
In Visual Basic, choose Add-Ins>Add-In Manager... The Add-In Manager dialog is displayed.
2.
If Source Code Control is not listed, close Visual Basic, edit your vbaddin.ini file (located by default in the %windir% folder), add the following entry under [Add-Ins32]
vbscc=3
3.
Basic versioning tasks
This section tells you how to perform the following tasks.
Adding a project to the depot
1.
Choose Tools>Perforce>Add Project to Perforce.
2.
Click Yes. If you enabled the Show the Perforce Connections option on the Preferences > Connection tab, the Open Connection dialog is displayed.
3.
On the Open Connection 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 Browse.
Password: the user's password, if any.
Workspace: the Perforce workspace you want associated with the version management operations you perform on the project. To choose from a list of workspaces defined for the specified server, click Browse.
4.
Click OK to save settings and dismiss the dialog. The Add Files to Perforce dialog is displayed, listing the files to be added.
5.
Click OK to dismiss the dialog.
6.
Right-click the project and choose Check In.... The Check in Files to Perforce dialog is displayed, listing files to be checked in.
7.
Click OK. The Submit Changelist dialog is displayed.
8.
Check the files you want to add, enter a comment and choose Submit. The files are added to the depot.
Checked-in files are displayed with a lock icon, as shown in the following figure.
Checking files out
To check out a file for edit, right-click the project file in the Project window and choose Check Out from the pop-up menu.
Checked out files are displayed with a red check mark, indicating that the files are writable.
Retrieving files from the depot
To get the most recent revision of a file from the depot, right-click the file and choose Get Latest Version.
To retrieve revisions prior to the head (latest) revision, you can sync from the Revision History dialog or perform the following steps:
1.
Choose Tools > Perforce >Get Latest Version... The Get Latest Version dialog is displayed.
2.
Check the files you want to retrieve and click Advanced... Dismiss the "Advanced sync dialog..." prompt by clicking OK, then click OK on the Get Latest Version dialog. The Sync dialog is displayed as shown in the following figure.
3.
Specify the revision you want to retrieve, using a Perforce changelist number, label, version number, or date. For details about specifying revisions, refer to the Perforce Command Reference.
To retrieve a file from the depot if you've deleted your local copy manually, check Force Sync. By default, Perforce assumes you still have your copy and doesn't retrieve it again.
4.
Click Sync..
If you retrieve a file that you already have checked out, for example, to obtain changes checked in by another user, Perforce will require you to resolve the file, to enable you to merge your changes with changes made by other users and to ensure that you don't inadvertently overwrite other changes.
Checking files in
After editing checked-out files, you must check them into the depot. Your edited files become the head revision in the depot. (If any of your changes conflict with changes previously submitted by another user, the check-in fails and the differences must be resolved using Perforce.)
To check in files, perform the following steps:
1.
Right-click and choose Check in... from the pop-up menu.
The Check In Files to Perforce dialog is displayed, listing the selected files.
2.
The Submit Changelist form is displayed.
3.
Your files are checked in. Checked-in files are displayed with lock icons.
To view all your pending changelists, click the Manage Changelists button on the Submit Changelist form. P4SCC displays a dialog listing your pending changelists. In this dialog, you can move files among changelists by dragging and dropping them.
Resolving file conflicts
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 Pending Changelist dialog:
To resolve file conflicts:
1.
In the Submit Changelist dialog, Right-click the file that has conflicts and choose Get Latest Revision.
The file is now scheduled for resolve, indicated by the message "Resolve this file before submitting."
2.
Right-click the file and choose Resolve Files... The resolve dialog is displayed, describing the extent of the file differences and listing the following options:
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.
Other choices: you can view either file (Open File...), diff your file with the conflicting file, display the file's revision history either textually or graphically.
After you choose how the files are resolved, the Submit Changelist dialog is redisplayed.
3.
Enter a description of your changes and click Submit. Your changes are checked in.
Diffing files
To diff a file you are editing with the head revision in the depot, right-click the file and choose Tools > Perforce > Show Differences...
To diff two revisions of a file, perform the following steps:
1.
Select the file and choose Tools > Perforce > Show History... The History dialog is displayed.
2.
The diff utility is launched, displaying file differences.
Reverting files
To discard changes you've made to a checked-out file and reload the head revision from the depot, right-click the file and choose Undo Check Out.
Working with Visual Basic files
Which files do I put in the depot?
In general, add the project file (such as .vbp files) but not the workspace file (.vbw files), especially if multiple developers are working on the same project. For example, if a developer has a workspace file checked out for edit and another developer adds a file to the project, the change is not reflected in the workspace file. Exclude the following Visual Basic file types from Perforce control; Visual Basic caches and recreates them as required.
.dca: active designer cache
.oca: control typelib cache
.vbg: group file
You can exclude them using Perforce protections or client views to prevent them from being inadvertently added to the depot.
Location of project files
The Project 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 Basic, it differs from the actual file structure in the following ways:
For some source control tasks, you need to identify the actual names and locations of these files. For detailed information about Visual Basic project files, see:
http://msdn.microsoft.com/en-us/library/Aa241721
Recommended Perforce file types
Following are recommended Perforce file types for Visual Basic files. For details about Perforce file types and attributes, refer to Introducing Perforce.
Checking out the project file
In Visual Basic 6.0 it is necessary to check out the project file (.vbp file) for edit to save any changes, including changes that affect only .frm files. If you do not want to submit an unchanged project file, right- click the project and choose Undo checkout. If multiple developers are working on the same project, keep the project file writable by setting its Perforce file type to +w when you add it to the depot.
 


Previous Table of Contents Index Next

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