Seapine Labs
Personal tools

Visual Basic 6 Integration

From Seapine Labs

Jump to: navigation, search

Contents

[edit] Background

This example starts with a project that is not associated with a source code control application and has not been added to Surround SCM yet.

Figure 1 shows the sample project in the project explorer.

Figure 1: Project Explorer
Figure 1: Project Explorer

As shown in Figure 2, the project is saved in the D:\WorkDir\Integration Example\ folder.

Figure 2: Project Location
Figure 2: Project Location

The D:\WorkDir\ directory is a folder that is the root for all the working directories for this computer. It is not a working directory for a repository, as shown in Figure 3.

Figure 3: Working Directories
Figure 3: Working Directories

[edit] Adding an Existing Project to Surround SCM

To add the project to Surround SCM, choose Tools > Surround SCM > Add Project to Surround SCM.

Figure 4: Add Files To Surround SCM Menu
Figure 4: Add Files To Surround SCM Menu

Surround SCM cannot establish an association because the project files have not been added to Surround SCM and the directory where the project is running from in Visual Basic (D:\WorkDir\Integration Example) is not set as a working directory in Surround SCM. You are prompted to establish this association, as shown in Figure 5.

Figure 5: Surround SCM Fix Prompt
Figure 5: Surround SCM Fix Prompt

To establish an association between the project and Surround SCM, click the Fix button to create a repository for the project.

The Repository Browser dialog box opens after you click the Fix button.

Figure 6: Repository Browser
Figure 6: Repository Browser

Select the branch and repository you want to create the new repository in. In this example, shown in Figure 7, the repository for the project will be created on the mainline branch under the top-level repository. Click the Create Repository button after the branch and repository are selected.

Figure 7: Repository Browser
Figure 7: Repository Browser

The Create Repository dialog box opens. By default, Surround SCM uses the project name for the repository and the directory that the project is running from as the working directory. Because this directory is not a child directory of the working directory for the parent repository (i.e., D:\WorkDir is not the working directory for the CremerSoft repository), the Inherit working directory from parent option is not selected.

Figure 8: Create Repository
Figure 8: Create Repository

Next, Visual Basic prompts you to add files to Surround SCM. You should add all files to Surround SCM, unless there are specific files that should not be controlled via Surround SCM.

Figure 9: Add Files Dialog Box
Figure 9: Add Files Dialog Box

At this point, the integration set up is pretty much finished. Surround SCM actions are available from the Tools > Surround SCM menu and from the shortcut menu for each file.

Figure 10 shows the Surround SCM actions available from both menus.

Figure 10: Surround SCM Actions
Figure 10: Surround SCM Actions

Figure 10 also shows the status icons added to the files to reflect the status of the file in Surround SCM. The project file has a lock icon, which indicates that the file is currently checked in. The form file has a red check mark icon, which indicates that the file is checked out.

[edit] Accessing Surround SCM Commands in Visual Basic 6.0

Most Surround SCM commands are available from the Tools > Surround SCM menu and from each file’s shortcut menu. The main difference is that a command selected from a file’s shortcut menu performs the command on that file only. Selecting a command from the Tools > Surround SCM menu performs the command on multiple files.

The following instructions use commands selected from the Tools > Surround SCM menu. If you use the shortcut menu, the dialog boxes may differ slightly.

[edit] Adding files to Surround SCM

When a new file is added to the project, it can also be added to the Surround SCM repository from the Visual Basic interface. Save the file in the working directory that corresponds to the repository where the file is to be added.

The following instructions show how to set Visual Basic to automatically prompt the user to add a file to source control every time a file is added.

To add files to Surround SCM through Visual Basic, select the file. Choose Tools > Surround SCM > Add Files to Surround SCM. The Add Files to Surround SCM dialog box opens.

Figure 11: Add Files to Surround SCM Dialog Box
Figure 11: Add Files to Surround SCM Dialog Box

Click the Advanced button to access additional add options.

[edit] Getting the latest file version

To get the latest version of files, choose Tools > Surround SCM > Get Latest Version. The Get Files from Surround SCM dialog box opens.

Figure 12: Get Files Dialog Box
Figure 12: Get Files Dialog Box

Click the Advanced button to access the following options:

  • Force file retrieval from the server: Forces a get of the server copy of the files regardless of the file in the working directory.
  • Make files writable: Retrieves a writable copy of the file.
  • Merge should first attempt auto-merge: If a merge is needed, and this option is selected, Surround SCM will first try to auto-merge the files. If this option is not selected, you may be prompted to manually merge the files. This situation usually only occurs with non-exclusive check outs when another user checks in changes at the same time.
  • Overwrite option: Specifies what happens if a modified file is found.
  • File timestamp: Specifies the timestamp to be placed on the file retrieved.
  • Get Based on Options: These options are used to specify which version of the file is retrieved. You can get a file based on the version, timestamp, label, or workflow state.
Figure 13: Advanced Get Dialog Box
Figure 13: Advanced Get Dialog Box



[edit] Checking out files

Check files out from Visual Basic when they need to be modified. To check out files, select one or more files then choose Tools > Surround SCM > Check Out.

Figure 14: Check Out Dialog Box
Figure 14: Check Out Dialog Box

Click the Advanced button to access the following options:

(Note: The recursive check box is unavailable because it does not apply to check outs from the Visual Basic IDE.)

  • Exclusive check out: Prevents other users from checking out the files.
  • Force file retrieval from the server: Forces a get of the server copy of the files regardless of the file in the working directory.
  • Check in as part of the following changelists: Attaches the files to a changelist when they are checked in.
  • View pending changelist after check out: Displays the pending changelists after the check out.
  • Overwrite option: Specifies what happens if a modified file is found.
  • File timestamp: Specifies the timestamp to be used when the files are checked out from the server.
Figure 15: Check Out Dialog Box
Figure 15: Check Out Dialog Box



[edit] Undoing check out

If a file is checked out and modified, but then a decision is made to not save the changes, the check out can be undone.

To undo a check out, select the file then choose Tools > Surround SCM > Undo Check Out.

Figure 16: Undo Checkout of Files from Surround SCM Dialog box
Figure 16: Undo Checkout of Files from Surround SCM Dialog box

Like the other dialog boxes discussed in this article, the undo checkout dialog box includes advanced options.

Figure 17: Advanced Undo Checkout Options
Figure 17: Advanced Undo Checkout Options
  • Get original version: Retrieves a read-only copy of the version of the file when it was checked out.
  • Get latest version: Retrieves a read-only copy of the latest version of the file. This will be different from the original version if the file was modified by another user while it was checked out (i.e., was not an exclusive check out).
  • Leave local file: Leaves the local file as is.



[edit] Checking in files

Changes that are made to files need to be checked in to the Surround SCM Server periodically. Simply saving the files does not automatically check in the files. Checking in the files creates a new version of the files and gives other users access to the changes.

To check in files from the Visual Basic IDE, select the files then choose Tools > Surround SCM > Check In.

Figure 18: Check In Files Dialog
Figure 18: Check In Files Dialog

Click the Advanced button to access the following options:

  • Prompt for Seapine Suite Integration: Displays a list of defects based on the TestTrack integration set up for the repository where the project resides in Surround SCM. This allows you to link the file with a TestTrack Pro defect.
  • Check in as part of a changelist: Attaches the file to a new or existing changelist.
  • View pending changelists after check in: Displays the pending changelists after the check in. The changelist can be reviewed, edited, and committed.
  • Apply comments to all: Applies the same comment to all files being checked in. Only applies when checking in more than one file at a time.
  • Change state when version updated: Change the state of the file in Surround SCM if the workflow is enabled for the repository where this file resides.
  • Get file after check in: Retrieve a read only copy of the file after it is checked in.
  • Keep checked out: Checks in the changes but leaves the file checked out and writable. This option is best used when applying periodic check ins as long series of changes are made. This can help avoid a catastrophic loss of work if the hard drive of the local computer crashes and the local file cannot be retrieved.
  • Leave local copy as is: Leaves a writable copy of the file in the working directory.
  • Remove local copy: Removes the file from the local directory.
  • Label: Labels provide a way to mark a specific version of a file or repository.
  • Skip server auto-merge: Checks in the file without merging it. The file becomes the new version even if another user made changes and checked in the file after the file was checked out.
  • Update version even if no change is made: Allows files that were not modified to be checked in. The version number increments by one.
  • Make files writable: Leaves the copy of the file in the working directory writable.
Figure 19: Advanced Check In Options
Figure 19: Advanced Check In Options


[edit] Refreshing file status

A query to the server to get the latest status of each file can be requested. For example, a file that is checked out from Surround SCM will not be marked as checked out in Visual Basic until you refresh the status.

To refresh the file status select the file and choose Tools > Surround SCM > Refresh.

[edit] Viewing file differences

Differences between the server copy and the working directory copy of a file can be viewed with the integrated diff/merge utility.

To view the differences, select the file then choose Tools > Surround SCM > Differences.

The differences utility starts if differences are found between the two file versions. For additional information about the utility refer to the application’s documentation.

[edit] Viewing file history

File history provides a way to view a source file’s history and work with a historical file version.

To view the history, select the file then choose Tools > Surround SCM > Show History. The History dialog box includes a summary of historic version information. Please refer to the Surround SCM User Guide for more information.

[edit] Possible Issues

The following information is provided to help you troubleshoot common issues.

[edit] Surround SCM in not available from the Tools menu

There are several reasons why Surround SCM is not available from the Visual Basic Tools menu.

  • Surround SCM is not the Default SCCI Provider
The first possible cause is that Surround SCM is not set as the default source code provider. To check this, log into the Surround SCM client. Choose Tools > User Options then select the Integration category. Make sure the Make Surround SCM my default SCCI provider option is selected.
Figure 20: User Options
Figure 20: User Options
  • Source Code Control Add-In in Visual Basic is not enabled in the Add-In Manager
It is possible that the Source Code Control Add-In in Visual Basic is not loaded or enabled. To check this, in Visual Basic, select Add-Ins > Add-In Manager... Make sure the Source Code Control Add-In is loaded.
Figure 21: Visual Basic Add-In Manager
Figure 21: Visual Basic Add-In Manager
  • Visual Basic was not installed with the Source Code Integration Option
This may occur when Visual Basic is installed without Visual SourceSafe. However, Source Safe does not have to be installed. Instead, you can add a reference to the vbaddin.ini file. The file resides in the \Windows\ or \WINNT\ directory.
Open the vbaddin.ini file. Look for the [Add-Ins32] section and add the following:
vbscc=3
Save the file and then reopen Visual Basic.
  • Version of Visual Basic does not support Source Code Control integration
Certain versions of Visual Basic 6.0 (like the academic edition) do not support source code control integration.

[edit] Visual Basic is unable to establish an association with an unrelated branch

When trying to add the project to source control, instead of getting the prompt to associate with a repository (Figure 5 above), you get a status message from Visual Basic that it was unable to establish an association between the directory where the project is running from and some other branch/repository. This can be confusing, especially if this branch or repository has no association with this project.

This can occur if a .MySCMServerInfo file exists in the directory tree and it references this unrelated branch or repository.

For example, in the project above, a .MySCMServerInfo file existed in the D:\WorkDir folder and referenced a different Surround SCM Server.

After the .MySCMServerInfo file was deleted, the integration worked as expected.

[edit] Guiffy Cannot be Loaded when Trying to View Differences

When you view file differences from the Visual Basic IDE, an error message similar to the one in Figure 22 may open.

Figure 22: Guiffy Error Message
Figure 22: Guiffy Error Message

To fix this, you need to edit the registry to allow for Guiffy to run as a separate process. The following key needs to be modified:

HKEY_CURRENT_USER\Software\Seapine Software\Surround SCM\SCM Client

The RunGuiffyAsSeparateProcess value must be set to true as shown in the Figure 23.

Figure 23: Registry Editor
Figure 23: Registry Editor

[edit] Surround SCM files are not displayed correctly in Visual Basic

Files have been added to Surround SCM but the Surround SCM menu items are not enabled when the files are viewed from Visual Basic. Check the following for possible causes and resolutions.

  • The Visual Basic project is configured incorrectly
Make sure the project points to a Surround SCM branch/repository that exists on the Surround SCM Server you are connecting to. To check this information, open the Visual Basic source control file, MSSCCPRJ.SCC, in Notepad and check the SCC_Project_Name and SCC_Aux_Path values. The format for ProjectName is <branch>:<repository>. The format for AuxPath is <server ip>:<server port>.
  • The branch/repository points to an invalid working directory
Make sure the working directory for the repository associated with the project points to the same local directory as the project. You may experience integration issues if the working directory points to a different location.
  • The local .MySCMServerInfo file is out of sync
Visual Basic cannot determine where Surround SCM files are located if the .MySCMServerInfo file is out of sync. Go to the directory where the Surround SCM files are located and open the .MySCMServerInfo file with Notepad. Make sure it points to the correct branch/repository. If it does not, delete the file and refresh it from Visual Basic to regenerate it with the proper data.

[edit] Files cannot be added to Surround SCM from Visual Basic

If files cannot be added to Surround SCM from Visual Basic, check the following for possible causes and resolutions.

  • Check the SCM output to view error messages
The Output window displays messages as Surround SCM performs actions. Check this window for error messages that occur when trying to add files.
  • The Visual Basic project is configured incorrectly
Make sure the project points to a Surround SCM branch/repository that exists on the Surround SCM Server you are connecting to. To check this, open the Visual Basic source control file, MSSCCPRJ.SCC, in Notepad and check the SCC_Project_Name and SCC_Aux_Path values. The format for ProjectName is <branch>:<repository>. The format for AuxPath is <server ip>:<server port>.
  • The Visual Basic project points to the wrong Surround SCM branch
This can occur if you maintain the Visual Basic source control file (MSSCCPRJ.SCC)in Surround SCM, then branch the repository that contains the files. After the repository is branched the local .MySCMServerInfo file still points to the old branch, which is where the files are being added. You need to re-configure Visual Basic to point to the correct branch then add the files to Surround SCM.
To make these changes open the Visual Basic source control file, MSSCCPRJ.SCC, in Notepad and check the SCC_Project_Name and SCC_Aux_Path values. The format for ProjectName is <branch>:<repository>. The format for AuxPath is <server ip>:<server port>.

[edit] An error message is returned when you perform a Surround SCM action

When Surround SCM actions, such as checking out files, are performed, an error message opens that states the file is not valid for the operation. Check the following for possible causes and resolutions:

  • Visual Basic cannot determine if the file is under source control
If you are certain the file is under source control refer to the other troubleshooting causes and resolutions to see if you can solve the problem. If the file is not yet under source control you need to add it to Surround SCM.













Issue Management Software | Source Code Control Software | Test Case Management