Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Articles
Search: 

Using Visual SourceSafe from Visual FoxPro
Oscar Zarate, February 1, 2003
Introduction Visual SourceSafe (VSS) is the version control (VCS) and source-code management system provided by the Microsoft Visual Studio product family. A version control system basically lets you manage the source programs within a development group, maintaining the entire modificati...

Introduction

Visual SourceSafe (VSS) is the version control (VCS) and source-code management system provided by the Microsoft Visual Studio product family.

A version control system basically lets you manage the source programs within a development group, maintaining the entire modification history of each component, controlling the developers' access to them, etc.

Before starting, I want to thank for the help given by Fernando Bacci.

What do we need a VCS for?

I will try to answer this question with some examples.

  • Did you ever need to recover an old version of a form that worked correctly until you tried to add some functionality?
  • Didn't you ever change the calculation procedure for taxes, and six months later, the law was, once again, similar to what it was before?
  • Didn't you ever use a form as a basis for another form, started to modify it, and then saved it? Yes, on top of the previous one; and now you have the form with the old name, and new functionality.
  • Did a virus cause a disaster on your development machine?
  • Did a new member of your team play the role of the virus, destroying your source code?

Surely this has already happened, or was about to happen. And probably, you resolved your problem recovering a backup that was on some magnetic or optical media, and for this purpose, you had to go to your backup library, to see which was the CD or tape, or the fireproof bank safe, and after some processes which cost a lot of hours, moneyand mental health, you managed to return to the state previous to the problem.

One of the functions of a VCS is to help for this kind of problems. You only have to discard the changes made, or review the change history in the version, to see which is most similar to the one you currently need.

This doesn't mean that you can forget about making backups; now, you must also make a backup of the VSS database.

Another very important function of a VCS is the administration of development groups, working on the same project, without having to use methods like the following:

  • "I modify the client form", shouts a developer.
  • A blackboard where you write down who modifies what.
  • Ten hours of the project leader's time to merge the correct contents provided by each person working on the project.
  • Other methods that we developed over the years.

VSS fulfills the function of a central database, which records which user has taken out which program, form, report, etc., for modifications, and which (unless you specify otherwise) doesn't allow others to modify it until the one who took it out frees it.

VSS lets you manage projects containing different kinds of files, like text files, graphic files, binary files, etc.

You can also share a file among different projects, having a single version, and when you modify something for a specific project, the change will propagate to all who share the file.

VSS is a truly multiplatform product; it is available for Windows, Macintosh and UNIX.

Working with VSS

VSS has an administration interface, and a separate client interface, that integrate perfectly into products such as Visual FoxPro (versions 5.0, 6.0, 7.0 and 8.0), Visual Interdev and Visual Basic version 6.0, as well as the .NET version. In this latter case, you need to run VSS version 6.0c.

Illustration 1: Server interface

With the administration program, you create the users and give them permissions; the users can be the same as the users defined in the operating system; if the user name is the same as the logged-in user, no password will be required.

With the client, you manage projects, files, versions, etc.

Illustration 2: Client interface

Specifically, talking about project administration, VSS uses a very simple, yet effective, method. When you add a project to VSS, what it does is create a copy in the VSS database, and keep a copy on your local disk. Each one of the files of the local copy will have the read-only attribute; this will give a warning in case there is any attempt to modify the file, even without using VSS.

Besides, if you add VSS as source control provider to any of the previously mentioned products, this will add a mark to the files, with an icon of a closed lock, indicating that the file is protected. When a user asks to modify a file, VSS will change the read-only attribute and will keep a record of which user selected this file for modification.

To better see this functionality, we will use a few examples created in Visual FoxPro, and we will purposely use different versions, to see how well VSS integrates with Visual FoxPro 6.0, 7.0 and 8.0 (beta).

Visual FoxPro and VSS

In the menu, option Tools, Options, in the "Project" tab, there is an option "Active Source Control Provider". In this option, we can select "Microsoft Visual SourceSafe". This allows us to interact with VSS from the Visual FoxPro interface.

Illustration 3: VFP menu

From this point on, in the menu option Projects, we will have the option "Add to source control" enabled. This will create a new project within VSS, which will manage it as a subdirectory structure.

The first thing we will note in our projects is an icon to the left of the name of each project component. This icon is a closed lock. Also, in the popup menu, and in the Project menu, we will have several options which correspond to VSS.

The most important ones are:

  • Get Last Version. Used to copy the latest version, for one or several components, from VSS to your local copy.
  • Check Out. Used to request the use and permission to modify one or more components, This changes the icon to a check mark.
  • Check In. Used to return the use and control of the component, previously checked out.
  • Undo Check Out. Used to undo the changes done after checking out one or more components.
  • Show History. Here, we can see the change history.
Next time we want to modify a project component, we will be asked whether we want to check it out; if it is used by another person (the icon will be a human outline instead of a key), we will be warned. If we accept, the read-only attribute is cleared, and we can modify it; otherwise, if we cancel, the component will be opened, but in read-only mode.

A very interesting option applies when two people modify the same component, when the second person wants to update, he will be informed that differences exist, and he will be given the option to merge among both changes, or leave one and lose the other one. In Illustration 4, we can observe:

ComponenteIcon/Status
holamundo.prg checked out
holamundo2.prg checked in
holamundo3.prg checked out by another user

Illustration 4: Example

VSS also gives us the possibility of assigning labels to different components of a certain version; this allows us to recover all components at a certain point in time, through a name.

Recommendations

  1. When implementing VSS, you should remember that before you generate a distributable version of your program or system, you should Check In all components that you want to be updated in this version, and then give the command Get Latest Version on the machine you compile on. In the Administration program, there is an option to search all components that are in a certain state (like Checked Out), this will show you who has taken a certain component.
  2. If you work with the administrator of some database, for instance Microsoft SQL Server, you can integrate the database to a Visual Interdev project, and add this to VSS. In this case, you should consider that the work is done through scripts, and not through the Enterprise Manager.
  3. In some cases, the implementation of VSS can make your work slower, since the need to Check In and Check Out requires additional network traffic, but this should not be significant. Otherwise, there are two things you should check. First, the network. Second, the antivirus.
  4. There are two very important utilities within the VSS package: SSARC and SSRESTOR. These two utilities are used to backup and resotre the VSS database.

Conclusions

Well, briefly, this is Visual SourceSafe, a tool which is simple to use, very powerful, and, adfater a while, addictive. I hope I awaked the interest of all of you, and that soon there are more Visual SourceSafe users.

Some links:

Oscar Zarate, National Australia Bank
Oscar Zárate is Bachellor in Business Administration, and Systems Analyst. He works as a developer since 1986, starting with the first versions of FoxBase, through Clipper, until the current versions of Visual FoxPro. He is MCP in Visual Basic .NET. He has also worked, among other tools, with Visual Basic, ASP, XML and SQL Server. He was the Treasurer of a the Microsoft User Group community (www.mug.org.ar). Currently, he is living in Australia after 36 years living in Argentina and now he is working for National Australia Bank after working more than one year for Triveni Infotech in Melbourne. www.oscarzarate.com.ar
More articles from this author
Oscar Zarate, June 1, 2003
A few years ago Microsoft launched a contest to award research projects among universities. On that topic, we interviewed Carlos Alejandro Pérez, Director of the project in the National Technological University (UTN), branch of the province of Chaco (Argentina). His project was selected from a...
Oscar Zarate, March 1, 2007
Since the time we program with object orientation, we can play at being all-powerful, deciding the lifetime of our objects, and limiting "what they can, and what they can't, do". Now, in some cases these objects seem to take on a life of their own, and don't respect our wishes. As the old saying goe...
Oscar Zarate, September 1, 2003
On August 7th and 8th took place at the Village Recoleta Complex this international event whose motto was "The more you know, the farther you reach". There were two days where the top speakers of Argentina gathered to bring out a true mega-event. Even more, the audience could take advantage of...
Oscar Zarate, March 1, 2003
Handling large text volumes is always a complication for systems, and mainly for ourselves, developers. When we have the need to handle fields with vast amounts of text our tribulations begin, and this is even worst if the user needs to search for a single word; of course not the first word of a phr...