Home Sitemap English
                                    Integrating IBM Rational ClearCase with Magic C++

                                                               Last update 2006/5/20

 

 

 

Contents:
Introduction
Software Requirements
UCM Concepts
Understanding Views
How to set up the ClearCase plug-in for the Magic C++ IDE
Magic C++ project files in ClearCase repository

Remote directory map setting before development

ClearCase setview before development

Adding new files to ClearCase
Joining a pre-existing UCM project
Checking out source files
Checking in source files
Handling hijacked files
Other ClearCase activities through your IDE
Conclusion
Resources
About the author
 

 

Introduction
In this article, you will learn how to integrate IBM® Rational® ClearCase® (a source code versioning system) and Magic C++. Using this integrated development environment, you will learn how to check in (or check out) your source code to (from) a ClearCase repository, which will reduce your product development time and increase your overall productivity.

ClearCase is the leading multisite source code configuration management currently available to the IT industry. ClearCase uses Unified Change Management (UCM), which is an out-of-the-box project management process layered on top of ClearCase.

ClearCase plug-in for Microsoft Visual Studio was designed primarily for use with MS Visual Studio, but in principle it can be used with any IDE that supports Microsoft's SCC API. Magic C++ Advanced Enterprise Edition 4.0 has implementated Microsoft SCC API, so any source control plug-in for Microsoft Visual Studio include ClearCase, VSS etc. can be reused in Magic C++ without any modifications.

Using the ClearCase plug-in for the Magic C++ IDE, you can perform all of the basic functions of configuration management, along with UCM operations. You can specify the repository path, add files into the repository, and check in or check out source code files from within your Magic C++ development environment. This functionality reduces application development time for developers who work with Microsoft technologies.

The procedures described in this article give you the specific steps to integrate ClearCase with the Magic C++ IDE.

Software Requirements
Server side:

  • ClearCase Server (ClearCase server is responsible for running various services like albd_server, vob_server, db_server, lockmanager, and so on, which handle requests from clients)

Client side:

  • Windows® 2000 or XP
  • ClearCase client
  • Magic C++ IDE Advanced Enterprise Edition 4.0 or higher

UCM Concepts
Adopting UCM makes it possible to manage your projects with ClearCase more efficiently, without needing to master the details of base ClearCase. UCM offers the convenience of a readily available management process. More details about UCM can be found in the documentation provided by IBM Rational ClearCase client setup. (By default, these files are installed to your C:\Program Files\Rational\ClearCase\doc\tutorial directory; open the file called index.htm to view the documentation)

In this article, you will learn ClearCase activities in the Magic C++ IDE using UCM, which also includes base ClearCase operations.

Understanding Views
A ClearCase view provides access to one version of each element in your project, an element could be a file or a directory or an object. In ClearCase Explorer, the view presents these elements in a tree format in the folders pane, similarly to Windows-based file browsers.

In UCM, a developer can create two views, a development view or an integration view:

  • Development view: This view represents the development stream or branch, which gives access not just to the elements, but also to the correct configuration of elements as determined by project policies and baselines. In this view, the developer checks out and modifies source elements, compiles them into object modules for testing purposes, formats them into documents, and so on.
  • Integration view: This view represents the integration stream or branch, which is the stream where all the work done in the project is collected. It shows the components and elements from all team members.

Each view has a view storage directory. ClearCase uses this directory to keep track of information such as which files are loaded into your view (for snapshot views only), and which versions are checked out to it. The view storage directory is for ClearCase administrative purposes only.

How to set up the ClearCase plug-in for the Magic C++ IDE
When you install the ClearCase client, it creates a registry entry for SCCServerPath under HKEY_LOCAL_MACHINE\SOFTWARE\Atria\ClearCase. The setup also installs a ccscc.dll file that provides the functionality for the ClearCase plug-in for the Magic C++ IDE.

Under a customized installation of ClearCase, you can't guarantee that ClearCase is installed in the default path (C:\Program Files\Rational\ClearCase\). If the SCCServerPath value is not set to the right path for the ccscc.dll file, then you won't be able to use the ClearCase plug-in. The following subsection describes how to make sure that you have the correct value for the SCCServerPath key.

Set the ClearCase Server path in the registry:

From Start menu, click Run and type regedit in the Run dialog. For Windows XP, type regedit32 to start the Windows Registry Editor. The Windows Registry is a repository of hardware and software settings for your computer. By using this tool, you can modify your system settings.

Note: Be careful when altering Windows registry settings; making incorrect changes to your registry can cause unexpected behavior or even system failure. For more information about the Windows Registry, consult the product documentation for your operating system.

You can modify the SCCServerPath string value in the Windows Registry Editor by expanding the navigation menu to: HKEY_LOCAL_MACHINE\SOFTWARE\Atria\ClearCase.

The value for HKEY_LOCAL_MACHINE\SOFTWARE\Atria\ClearCase\ SCCServerPath should reflect the correct path for your installed IBM Rational ClearCase client, as shown in Figure 1, where this value is set to C:\Program Files\Rational\ClearCase\bin\ccscc.dll. For example, let's say that you installed ClearCase to your computer's D: drive. To change the value for the registry path, right-click SCCServerPath in the details pane of the Registry Editor and click Modify. Edit the path information in the Edit String dialog box, and click OK.

Figure 1. The Windows Registry Editor
The Windows Registry Editor

Remote directory map setting before development
Magic C++ is visual remote IDE for Unix/Linux/BSD under windows, it integrates remote Edit/Compile/Debug functions in IDE. Magic C++ Enterprise Edition accesses Unix/Linux/BSD remote files via FTP/SFTP protocol, but it's different for Magic C++ Advanced Enterprise Edition, it accesses Unix/Linux/BSD remote files directly as windows local files with assistance by 3rd party tools include Samba, IBM Rational ClearCase Client for windows etc., these tools can map Unix/Linux/BSD remote directory to windows local directory seamlessly for user applications transparent access. You MUST setup windows mapping driver by those 3rd party tools before using Magic C++ Advanced Enterprise Edition, then configure the mapping information in the IDE.

Generally you need specify a Unix/Linux/BSD remote directory for a windows local directory which in a ClearCase mapped drive, ClearCase will synchronize between them because they are in the same view but mounted on different places. With this mapping relationship Magic C++ will forward all the operations include Compile/Debug to the remote Unix/Linux/BSD servers, and present a seamless interface to execute compiler and debugger.

Click File->Remote Directory Map... and configure mapping settings as below:

Figure . Remote directory map setting in Magic C++

ClearCase setview before development
Typically, most of your work involves just one view. Moreover, you will probably want to use standard operating system pathnames to access version-controlled objects. For both these reasons, you will probably want to begin your ClearCase work by setting a view. This creates a process in which an element's standard name automatically accesses a particular version of that element — the version selected by the view's config spec.

This set view capability completes ClearCase's transparency feature — the version-control mechanism disappears completely, allowing system software and third-party applications to process versions of elements as if they were ordinary files, using ordinary pathnames.

A process with a set view can spawn any number of subprocesses, to any nesting level, using standard UNIX commands and subject to standard UNIX restrictions. All these subprocesses are also set to the view.

Magic C++ needs execute clearcase setview command before executing any other remote development commands include Find/Replace/Compile/Debug etc., you can add clearcase setview command in the post-login commands editbox, it will be executed automatically everytime after login to the remote server.

Figure . Add ClearCase setview command in Magic C++

Magic C++ project files in ClearCase repository
For a Magic C++ developer, it is important to understand which C++ files should be checked in to the source control repository. Whenever you create a simple HelloWorld console application, the Magic C++ IDE creates a bunch of files like *.cpp, *.h, some project information files, and so on. In addition, when you compile and build this application, the IDE will create compile and link output files under your project directory, where you will find object files, executable files, and debug information files, These files (*.o, *.exe), however, should not be added into the source control repository.

When you are working with a project team that is geographically distributed, you should make sure that your team is using the same project settings; these settings are kept in a .prj file, and this file should be checked in to the source code control repository. In general, it is recommended that the following files be checked in to the repository:

*.cpp, *.h, *.prj, *.wsp, *.mk

The following is a list of files that should generally not be added to the source control repository:

*.o, *.exe, *.a, *.so

Adding new files to ClearCase
Through time, your project can grow to contain hundreds or thousands of files, so during the development of a project using Magic C++ , you can easily add these new files into the ClearCase repository. You should make sure that your ClearCase administrator has created a UCM Project repository for your project. Furthermore, you can use all of the ClearCase functionality only if you create a development view on your machine; it is not recommended that you work in an integration view for development activities.

The following example with a simple HelloWorld application illustrates how to add new files to ClearCase.

  1. Open the Magic C++ IDE.
  2. Create a typical console "Hello World" sample application using the Project Creation wizard.
  3. In the FileView tab, you will see some .cpp, *.h, *.mk files.
  4. Select the files to be added to source control, right-click them, and in the popup menu, click Add to Source Control (as shown in Figure 2).

Figure 2. Adding Magic C++ project files to ClearCase
Windows pop-up menu showing the Add to Source Control command in Magic C++

If you already have some Magic C++ projects created, and you want to use ClearCase as a source code control repository, then your ClearCase administrator should create a new UCM project using ClearCase Project Explorer. When your ClearCase administrator creates a UCM project for you, then ClearCase creates the project's integration stream for you. By default, a project contains only one integration stream, which maintains the project's baselines. The integration stream configures integration views to select the versions associated with the foundation baselines, plus any activities and versions that have been delivered. To see and make changes to the project's shared elements, you need an integration view.

Joining a pre-existing UCM project
If your ClearCase administrator has already created a UCM project for your development effort, then you must join that UCM project in order to start development on it. Before doing this, you may want to review this procedure in the ClearCase help files (described above). These files contain an overview of UCM developer tasks and a tutorial that describes the Join Project wizard, the tool used to join UCM projects (see Figure 3).

Figure 3. ClearCase client help files - Joining a UCM project
ClearCase help files

Checking out source files
Figure 4 illustrates how you can check out files directly from the Magic C++ IDE using the context menu: just right-click the file, and click Check Out. . Once you have checked out the source files from ClearCase, Magic C++ puts a red tick mark before the name of the file.

Figure 4. Checking out source file from ClearCase using the Magic C++ context menu
Windows pop-up menu showing checked-out status of file

Checking in source files
Once you are done with development in IDE, you can check in the checked out files (from the Magic C++ IDE to the ClearCase repository).

It is good practice to check in your files regularly, such as at the end of the day. While processes differ among development teams, even within the same company, it is important to check in your files when:

  • You have made substantial changes to the file
  • A bug has been fixed in response to a change request
  • Other team members need access to your file - for example, if they would like to perform a test build
  • When you foresee being out of the office

Similarly to checking out files, you can check in source files using the context menu in Magic C++, just right-click the file (note the red check mark), and click Check In, as shown in Figure 5.

Figure 5. Checking in a checked-out file (note the red check mark next to the filename)
Windows pop-up menu showing check-in command

Undo check out
If you wish to undo the changes you have made and revert back to the previous version of the file, then you can select the file and click the Undo Check Out option in the same context menu seen in Figure 5.

Handling hijacked files
When ClearCase loads a file element into a snapshot view, it applies the file system's read-only attribute to the file. If you change this attribute, and modify the file without checking it out first, ClearCase considers the file hijacked. Only files under source control can be hijacked; view-private files are not under ClearCase control, so you can modify them without involving ClearCase.

Hijacking takes a file outside of direct ClearCase control. Although ClearCase detects the change to the file whenever it is modified, it is not recommended to hijack files as standard practice. You cannot hijack files in dynamic views, since this view is the collector stream for all work done in the project. Hijacking does not apply to directory elements.

Other ClearCase activities through your IDE
Along with the above-mentioned ClearCase activities that can be performed through your development environment, you can also perform the following useful source code control activities through the Magic C++ IDE:

  • Get Latest Version: You can get the very latest version of any element added to the repository using the Get Latest Version option on the Project menu, just click Project > Source Control > Get Latest Version. If you are working with a dynamic view, then you will always have the latest version of every element. Whenever you have your own development stream, you should rebase it to the latest recommended baseline available each day.
  • Show History: With each checkout and checkin, a new version of the file is created. Over a period of time, these checkouts and checkins create a change history, which you can view by clicking Project > Source Control > Show History in Magic C++.
  • Show Differences: Eventually, you may have a huge number of lines of code in the .cpp file, and want to see what changes have been made between two particular versions of the file. You can select different versions of a file and view the differences between them by clicking Project > Source Control > Show Differences in Magic C++.

Figure 6. Get latest version

Figure 7. Show history

Figure 8. Show differences

Conclusion
There are numerous advantages to integrating ClearCase with your IDE: ease-of-use, ease-of-implementation, and rapid development, just to name a few. By integrating ClearCase with the Magic C++ IDE, you can not only increase your productivity, but it gives you a fully integrated product development environment that encompasses the software product development process all the way from coding through configuration management. So if you are a Magic C++ developer who knows the basics of source code control activities but may not be interested in having to learn more, then integrating your Magic C++ IDE with ClearCase will give you all the advantages of source code control management without impacting your daily work activities.

Resources

 


   

Back to top

 

HomeProductPurchaseDownloadSupportPartnerContact

Copyright © 2007 Magicunix Information Technology Limited. All rights reserved.