Previous Next Contents Index


Working with Source Control

This section describes the source control features available within Netscape Application Builder.

The following topics are described in this section:


About Source Control
Source control lets you track multiple file revisions and offers the following advantages:

Before you can use source control in Netscape Application Builder, an underlying source control utility must be installed in your development environment. You must also configure Netscape Application Builder for the particular utility you intend to use.

It is assumed that you a familiar with source control concepts and with the utility you intend to use. For more information, refer to the documentation that comes with your site's source control utility.


Configuring Source Control
Once a source control utility is available for you to use, you configure Netscape Application Builder as follows:

  1. Specify which source control utility to use.
  2. Map the source control menu items in Netscape Application Builder to corresponding command lines in the source control utility.
You perform these tasks from the Source Control tab in Netscape Application Builder. From the Tools menu, choose Development Options and then click the Source Control tab. The following dialog box appears:

Specifying a Source Control Utility
Often, a network administrator sets up a particular source control utility for use in a networked environment. This setup may include defining user IDs for anyone who plans to use source control. Set up may also define policies for directory names and hierarchies. Keep this in mind as you specify a source control utility.

To specify a source control utility, use the drop-down list near the top of the Source Control tab and select one of the following supported utilities:

Choose the source control utility installed on your machine. If you select a user-defined source control utility, no default command-mappings are provided. In this case, you need to map the menu items from scratch.

Defining Menu Items
In the Source Control tab, the Commands area shows command-line equivalents for the items in the Source Control submenu.

For example, suppose PVCS is the selected utility, as shown in the previous figure. The Show History text field contains the command:

vlog %b%e
In this example, when you choose Show History from the Source Control submenu, Netscape Application Builder calls the PVCS utility, which in turn executes the vlog command. The characters %b and %e are macros, which are substituted for their current values at execution time. For more information, see Macro Definitions.

Netscape Application Builder supplies default command-line equivalents. However, you can edit the text fields to suit your needs. You can also restore default values by pressing the Defaults button.

Before you edit text fields on the Source Control tab, make sure you understand the following topics:

Relationship of Text Fields to Source Control Submenu
The following table describes the text fields on the Source Control tab and their corresponding item on the Source Control submenu:

Label in Source Control Tab
Equivalent Item
on Submenu

Description
Get
Get Latest Version ...
Updates selected files with their latest version from the source control system.
Check Out
Check Out ...
Checks out selected files from the source control system and opens them for editing.
Check In
Check In ...
Checks in selected files to the source control system, with a comment.
Check In, Locked
Check In ...
If you select the "Keep checked out" box, files remain checked out (locked) after changes are submitted.
Undo Check Out
Undo Check Out ...
Reverts the local version of selected files to the version in the source control system.
Add File
Add to Source Control ...
Adds files to the source control system.
Remove File
Remove from Source Control ...
Removes selected files from the source control system. Files are not removed from the project directory.
Show History
Show History ...
Displays revision history for selected files.
Start GUI
Source Control System ...
Displays the graphical user interface of the source control utility. This item is useful when you want to work directly with the utility.

Default Values for Command Lines
You can edit the command lines, or you can use the default values shown in the following table. A command is executed once for each of the selected files as if the command were run from the command line after making substitutions for macros. If you change a command line, the command line must conform the following conventions:

To debug your command line, you should check Netscape Application Builder's message window to view the macro substitution. If your command does not work, you should check it outside of Netscape Application Builder by attempting to execute the NAB-generatied command from the command line.

The following default commands are defined for CVS:

Label in Source Control Tab
CVS Command
Get
cvs co %r%e
Check Out
cvs co %r%e
Check In
cvs commit -m%Q %r%e
Check In, Locked

Undo Check Out

Add File
cvs add -m%Q %r%e
Remove File
cvs log %r%e
Show History

Start GUI

The following default commands are defined for PVCS:

Label in Source Control Tab
PVCS Command
Get
get -y %b%e
Check Out
get -y -l %b%e
Check In
put -n -M%Q %b%e
Check In, Locked
put -n -M%Q -l %b%e
Undo Check Out
vcs -y -u %b%e
Add File
vcs -i -n -t%Q %b%e
Remove File
del /f %b%e
Show History
vlog %b%e
Start GUI

The following default commands are defined for Visual Source Safe:

Label in Source Control Tab
Visual Source Safe Command
Get
ss GET -I- %r%e
Check Out
ss CHECKOUT -I- %r%e
Check In
ss UPDATE -I- -C%Q %r%e
Check In, Locked
ss UPDATE -I- -C%Q -K %r%e
Undo Check Out
ss UNCHECKOUT -I- -G- %r%e
Add File
ss ADD -I- -C%Q %r%e
Remove File
Remove="ss DELETE -I- %r%e
Show History
ss HISTORY -I- %r%e
Start GUI

Macro Definitions
You define source control commands using macros, which are substituted for actual values when the command is executed. You can choose from among the macros listed in the following table. Note that the examples provided are based on the following files:

Setting Up the CVS Environment
To use CVS commands from Netscape Application Builder, you must map your application source directory to a CVS archive. Typically, you manually copy the CVS directories and their contents from the client source tree to your application directory.

For example, to set up CVS source control for your Java code files, you would perform the following steps:

  1. Set youir CVSROOT environment variable.
  2. 	set CVSROOT=:pserver:user@cvsserver:/m/src
    

  3. Change to a directory in which CVS is already set up and add the application directory tree at each level.
  4. 	cd D:\cvssource
    mkdir Netscape
    cvs add Netscape
    cd Netscape
    mkdir Server4
    cvs add Server4
    cd Server4
    mkdir NAS
    cvs add NAS
    cd NAS
    mkdir cdx
    cvs add cdx
Note. If you use a FAT partitioned disk, you cannot use case-sensitive names because CVS is case sensitive but FAT directory names are not. In this case, you should use an NTFS partition.

  1. From the command line, add a single file into your application directory.
  2. 	cd cdx
    cvs add dummy.txt

  3. From the top-level, commit the file, which causes CVS to create a repository tree.
  4. 	cd D:\cvssource
    cvs commit

  5. From your CVS client tree, such as D:\cvssource, copy the applications directory, such as Netscape (and includes the file you just added), to your server directory; for example, D:\Netscape.
Setting Up Visual SourceSafe
To create a Visual SourceSafe project and add a Netscape Application Builder project, perform the following tasks:

  1. Launch the Visual SourceSafe Explorer.
  2. Right-click on the root folder ($/) and select "Create Project."
  3. Specify the name of your Visual SourceSafe project; for example, NABApps, and click OK.
  4. Right click on "Set Working Folder."
  5. Specify or navigate to the directory that contains your Netscape Application Builder projects; for example, D:\Netscape\Server4\NAS\Apps.
  6. For each Netscape Application Builder project you want to place under source control, right-click on your Visual SourceSafe project, select "Create Project" and specify the name of the Netscape Application Builder project.
You can add users for Visual SourceSafe using the Visual SourceSafe Admin program. The program creates an ss.ini file in the Users subdirectory in which Visual SourceSafe is installed. The file should contain at least the following entries:

; Your current SourceSafe project
Project = $NABApps
Force_Prj = Yes
...
[$/NABApps]
Dir (your_host_machine)=D:\Netscape\Server4\NAS\Apps
If you are creating multiple accounts, you can simply replace each user's ss.ini file with the one you created initially by copying it to their Users subdiretory.


Invoking Commands from the Main Menu
You invoke source control commands by pulling down the Tools menu, choosing the Source Control submenu, and then choosing one of its menu options. As shown in the following figure, you can select one or more files from the Project window first, but selecting files is optional.

When you invoke a source control command, a Select Files dialog box appears. For example, suppose you are working in the HelloWorld project. If you highlight index.html in the Project window and then choose Add to Source Control, the following dialog box appears:

The Selected Files window, on the right, lists the full path names of any files you had previously selected. The window on the left lists all other files in the project.

Using the Select Files dialog box, you can change the set of files that you want to affect. For example, if you want to add more files to the source control system, you can highlight other listed files and then click the right arrow button. When you press OK, you apply the source control command to whatever files are listed in the Selected Files window.


Sharing Settings Among Programmers
In many cases, several programmers work on the same project, but each programmer might be using a different source control configuration. It may be desirable for everyone to share the same configuration settings.

To share these settings, one programmer can export them from the registry to a file. Other programmers can then import the resulting file into their respective registries.

The following procedure describes how to export source control settings:

  1. Open the Netscape registry editor by typing regedit from a DOS command prompt.
  2. Locate the key denoted by the path HKEY_LOCAL_MACHINE\SOFTWARE\Netscape\
    Application Builder\4.0\SCCS
  3. Select the SCCS folder.
  4. From the Registry menu, choose Export Registry File.
  5. Specify the name and location of the file.
Once the source control settings are exported, you can import them in either of the following ways:

 

© Copyright 1999 Netscape Communications Corp.