Normal
0
false
false
false
EN-US
X-NONE
X-NONE
MicrosoftInternetExplorer4
Establishing the
Developement Environment
Establish the environment for
source-code version control - Chapter Objectives
- The first objective requires you to have some knowledge
of Visual SourceSafe 6.0, which is bundled with VB 6.0, Enterprise
Edition. You can use Visual SourceSafe to manage the files for source code
through different versions of a single project.
You can also use Visual SourceSafe to prevent conflicts and confusion
among developers who are working on the same project at the same time.
- Install and configure Visual Basic for developing
desktop/distributed applications
Contents
- Implementing
Source-Code Control with Visual SourceSafe
- The
Nature of a Visual SourceSafe Project
- The
Visual SourceSafe Database
- Visual
SourceSafe Administrator
- Archiving
and restoring Visual SourceSafe databases
- Restoring
a Visual SourceSafe Project from Archive
- Using
Visual SourceSafe Administrator to Set Up and Maintain Users
- Visual
SourceSafe Explorer
- Creating
a New Project Folder in Visual SourceSafe
- Adding
Files to a Visual SourceSafe Project
- Setting
the Working Folder for a Project
- Checking
Out, Checking In, and Getting Working Copy
- Source-Code
Labeling and Version Numbers
- Source-Code
Sharing
- Source-Code
Branching
- Pinning
an Earlier Version of a File for Use in the Current Version of a Project
- Merging
Two Different Versions of a File
Implementing Source-Code Control
with Visual SourceSafe
Version control is a term that
describes the actions that software developers must take to keep track of the
physical files that go into various versions of a software product. Version
control is basically concerned with two types of control:
- Keeping track of changes to files over time and
matching the various versions of a file with versions of a software
product.
- Managing concurrent changes made by multiple developers
to a project's files and keeping their changes from conflicting with each
other.
Visual SourceSafe has three basic
components that you need to know about to understand how it works to implement
version control:
- The Visual SourceSafe database. This is the repository for the various versions of
source code and other files that Visual SourceSafe administers. The Visual
SourceSafe database stores the files in a compressed, proprietary format.
It must be visible to all developers and administrators who need to use
Visual SourceSafe.
- Visual SourceSafe Administrator. This application enables one or more administrators
to manage the Visual SourceSafe database, to manage users of Visual
SourceSafe, and to define the users' rights in general and also for
particular projects.
- Visual SourceSafe Explorer. This application resides on each developer's
workstation. It is the main vehicle that developers use to manage the
source code stored in the Visual SourceSafe database.
Visual SourceSafe is typically
installed as an option with VB or Visual Studio. You should make sure that the
Visual SourceSafe database is installed in a location visible to all who will
need to use it (probably on a network drive). The default name for the
installed folder is VSS. The exact location of this folder will depend on the
choices you make during Visual SourceSafe installation.
The
Nature of a Visual SourceSafe Project
A Visual SourceSafe project
typically corresponds to the physical files in a development project.
Developers usually think of a Visual SourceSafe project as containing source-code
files (in the case of a VB project, file types would include VBP, FRM, BAS,
CTL, and so forth).
A Visual SourceSafe project can
contain any files important to the project, however—such as email documents
containing correspondence, design, specification, and project-management files
in word processor format or in the formats of other software tools, as well as
the latest compiled version of the executable files created from the source
code.
The
Visual SourceSafe Database
The Visual SourceSafe database
contains all the files that Visual SourceSafe maintains. Visual SourceSafe
stores the files in a proprietary, compressed format.
You will find the Visual
SourceSafe database under the main Visual SourceSafe directory (usually named
VSS) in a folder named Database.
You will see several files under
this folder and a lot of other folders containing many other files. You should
never try to manipulate the contents of the Visual SourceSafe database
manually, because Visual SourceSafe has its own internal scheme for managing
the database.
It is possible to have multiple
Visual SourceSafe databases set up in the same environment. When administrators
or developers open the Visual SourceSafe Administrator or the Visual SourceSafe
Explorer (as mentioned in the following sections), they have a choice of Visual
SourceSafe databases.
Figure in the section titled "Using
Visual SourceSafe Explorer" illustrates the choice of databases for a
user in Visual SourceSafe Explorer. A Visual SourceSafe administrator can also
archive and restore Visual SourceSafe databases, as discussed further in the
section titled "Archiving
and Restoring Visual SourceSafe Databases."
Visual SourceSafe Administrator
You can use Visual SourceSafe
Administrator to
- Set up and remove users of Visual SourceSafe and set
their Visual SourceSafe passwords.
- Assign rights to users of Visual SourceSafe for
specific projects or in general.
- Set options for Visual SourceSafe projects.
- Archive and restore Visual SourceSafe projects in
specific Visual SourceSafe databases.
- Set options for the general behavior of Visual
SourceSafe.
To answer SourceSafe-related
questions in Visual Basic, you will need to know about some of these
administrative functions:
Restoring
a Visual SourceSafe Project from Archive
STEP BY STEP
1.
Choose
the Archive, Restore Projects menu option.
2.
On
Screen 1 of the Restore wizard, browse to the Visual SourceSafe archive (SSA)
file that you want to restore, and click the Next button (see Figure 2.5).

FIGURE 2.5 - Specifying an
existing Archive file to restore from.
3.
On the
screen for step 2, choose the projects from the archive that you want to
restore (see Figure 2.6)

FIGURE 2.6. - Specifying the
projects that you want to restore.
4.
On the
screen for step 3, select where you would like the project restored. Click the
Finish button and wait for the Restore wizard's notification of success (see
Figure 2.7).

FIGURE 2.7. Step 3 of the Restore
wizard.
You can use the Archive/Restore
feature of Visual SourceSafe to transfer projects between two Visual SourceSafe
databases. To transfer a project from one Visual SourceSafe database to
another, follow these steps:
1.
Archive
the project from the database where it originally existed (the source).
2.
Restore
the archived project to the destination database.
Using
Visual SourceSafe Administrator to Set Up and Maintain Users
Although Visual SourceSafe
Administrator can leave most general Visual SourceSafe settings at the
installed default values, there is one task that you must perform in Visual
SourceSafe Administrator for Visual SourceSafe to function properly: setting up
users.
Developers cannot have access to
Visual SourceSafe Explorer and the projects contained in the Visual SourceSafe
database unless they have a logon account for the Visual SourceSafe database.
To set up a user for access to the Visual SourceSafe database, follow these
steps:
STEP BY STEP
2.3 Setting Up a User with
Visual SourceSafeAdministrator
1.
Open
Visual SourceSafe Administrator and choose Users, Add User from the main menu
to bring up the Add User dialog box (see Figure 2.8).

FIGURE 2.8 - Adding a SourceSafe
user account.
2.
Fill
in the logon ID for the user whom you are setting up.
3.
Assign
a password.
4.
If you
don't want the user to be able to change information stored in the Visual
SourceSafe database, check the Read Only box as well.
5.
Click
OK to close the dialog box and create the user account.
NOTE: Visual
SourceSafe Security and Windows Security Visual
SourceSafe Explorer will automatically try to use the Windows user ID and
password to log on a user who runs Visual SourceSafe Explorer. If the user ID
and password match a user ID and password in Visual SourceSafe, the user will
receive no logon prompt to Visual SourceSafe Explorer.
Visual SourceSafe Explorer
When you run Visual SourceSafe Explorer, the first thing that you see
depends on how the administrator set up your Visual SourceSafe account:
- If the Visual SourceSafe administrator set up a user
with the same name and password as your Windows logon and password, Visual
SourceSafe Explorer will proceed immediately to the main screen.
- Otherwise, Visual SourceSafe Explorer will present you
with the logon screen. In this case, you will need to supply a valid
Visual SourceSafe logon/password combination as set up by the Visual
SourceSafe administrator.
You can also click the Browse button
on the logon screen to choose from all the Visual SourceSafe databases
recognized by Visual SourceSafe on your system (see Figure 2.10). You can also
wait until you see the main Visual SourceSafe screen, and select the File, Open
SourceSafe Database from the menu to choose a different database.

FIGURE 2.10 - Choosing a Visual SourceSafe database.
Following is a list of some of the
things that you can do with a project's files in Visual SourceSafe Explorer:
- Set working folder.
You can specify the physical location on your system where you want to put
a project's files when you view them or work with them.
- Check out.
You can get a writable copy of a file from the SourceSafe database.
Normally, only one developer at a time can check out a given file.
- Check in.
You can return a modified copy of a file to the SourceSafe database. The
modified file is now available for other developers to check out.
- Get working copy. You
can get a read-only copy of a file from the Visual SourceSafe database.
Anyone can get working copies of a file, even if someone else currently
has it checked out.
- Label. You
can designate versions of one or more files in a project with a label of
your choosing. You can get copies of all the files designated with a
single label and thus reproduce a particular version of a project.
- Share.
You can share the same copy of one or more files between various projects.
- Branch.
You can break the link between shared copies of the same file so that you
can then develop the copies independently.
- Pin. You
can freeze a particular version of a file or project so that no more
changes can be made to it.
- Difference. You
can view the differences between two different versions of a file.
- Merge.
You can merge two different versions of a file together. You can view each
difference and decide how to merge.
The following sections discuss many
of these activities.
Creating a New Project Folder in
Visual SourceSafe
The structure for storing Visual
SourceSafe projects looks somewhat like the Windows File Folder tree as
presented by Windows Explorer (see Figure 2.11).

FIGURE 2.11 - The project tree in Visual SourceSafe Explorer.
All projects in the Visual
SourceSafe database are stored under a root folder (denoted by a folder labeled
"$/" at the top of the tree hierarchy).
To add a new project to Visual
SourceSafe, follow these steps:
STEP BY STEP
2.4 Adding a New Project to Visual SourceSafe
- Run and log on to Visual SourceSafe Explorer.
- Select either the root folder ($/) or an existing
project folder. The project you create will belong under the folder that
you select.
- Choose File, Create Project from the menu.
- Under the Create Project dialog box, assign a name to
the project and enter any comments. Click the OK button to create the new
project's folder in Visual SourceSafe (see Figure 2.12).

FIGURE 2.12 - Creating a new project folder (figure shows both the
dialog box to create the folder and the newly created folder).
- Add files to the project (you may do this at a later
time). The next section describes this action in detail.