Wednesday, September 10, 2008

Migrating Visual Studio.NET project from VisualSourceSafe to ClearCase while retaining history

This article by IBM has a complete description of migrating the .NET project which is currently under the VSS to ClearCase with history. But still it doesn't much explain about exporting the project / solution from VSS and importing back to the ClearCase by using the clearexport_ssafe and clearimport. The below given section explains them better.

To export the project's / solution's information along with history we need to use the clearexport_ssafe command in the DOS prompt. This article explains about the same, but still it doesn't have any sample to explain. The below given sample batch file explains it better.

This is the batch file commands, which I used when migrating one of my .net project from VSS to ClearCase.

SET PATH=%PATH%;C:\Program Files\Microsoft Visual SourceSafe;(The loaction of the SS.exe in the machine)
SET SSDIR=\\NetwrokVSSDatabaseLocation\VSS DatabaseName (eg., \\TestLocation\TestDatabaseName)
SET SSUSER= VSS User Name (This user should be created in VSS database with blank password)
SS CP $/VSSProjectLocation (eg., $/TestProject)
clearexport_ssafe -r

Running the above batch file, will generate a file in the same folder with the name "cvt_data". This is the file having the complete VSS project data with history.

Then while importing the data back to ClearCase, the command used is

clearimport -pcase "cvt_data file location"

This command should be executed in DOS prompt in the location of VOB where you need to move your data. Consider your project's VOB is mapped to Z: directory in your machine and your project's VOB name is TestVOB. Then you chould first change the directory to "Z:\TestVOB\FolderName". Then execute the above command with the correct CVT_Data file location.

In the above command the switch -pcase is used to tell import utility to preserve the case of the files while importing. If this attribute is missed, by default clearimport will import the files with all lowercase letters.

If you are not the VOB owner, then running the above command will give you a "Permission Denied" error. To avoid this run the command with the switch -nsetevent, like shown below

clearimport -nsetevent -pcase "cvt_data file location"

This will import the files exported using the "clearexport_ssafe" command. Now your VOB would be having the complete VSS project's data along with history.

References:

http://www-01.ibm.com/support/docview.wss?rs=0&uid=swg21222507
http://publib.boulder.ibm.com/infocenter/cchelp/v7r0m0/index.jsp?topic=/com.ibm.rational.clearcase.books.cc_admin.doc/import-export.htm
http://www.astrainfotech.com/rsdc-2006-dilip.pdf