Perforce 2007.2 Using IDE Plug-ins
<< Previous Chapter
Microsoft Visual C++
Table of Contents
Index
Perforce on the Web
Next Chapter >>
Microsoft Visual Studio .NET

Chapter 3
Microsoft Visual Basic

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" on page 12.

The Perforce submenu lists the SCM 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]

  3. Save the file.

Basic SCM 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:

  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.

  4. Click Sync.

    Note

    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.

    .

    Note

    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. Check the files you want to checked in and click OK.

    The Submit Changelist form is displayed.

  3. Enter your comments and click OK.

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:

  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. Click and drag one of the revisions you want to diff, and drop it on the other revision.

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.

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:

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.

File type
Perforce file type
Description

.bas

text

Basic file

.cls

text

class file

.ctl

text

control file

.ctx

binary

control binary file

.dsr

text+w

designer file

.dsx

binary

active designer binary file

.frm

text

form file

.frx

binary

form binary file

.vbg

text+w

group project

.vbp

text

project

.vbw

text+w

workspace

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.


Perforce 2007.2 Using IDE Plug-ins
<< Previous Chapter
Microsoft Visual C++
Table of Contents
Index
Perforce on the Web
Next Chapter >>
Microsoft Visual Studio .NET
Please send comments and questions about this manual to [email protected].
Copyright 2001-2007 Perforce Software. All rights reserved.
Last updated: 09/07/07