Thursday, November 30, 2006

Migrated to Subversion 1.3.2..

The motivation behind writing this blog is that after using one of our project on subversion without a proper migration we had serious concern over subversion that shall we go ahead with it so we should stop using it and back to Microsoft Visual SourceSafe (VSS) or some other configuration tool; because we were struggling to do the proper migration from VSS to subversion repository. The reasoning behind selection of subversion was the features of subversion. My PM; Mr. Suryatej asked me to do some R&D on this issue to check whether it is possible to migrate (With complete revision History of file in VSS) to Subversion with my regular work for client 401J.

After sourcing the Internet for a good VSS to Subversion migration tool, I came up with few Perl and Python scripts. I found the script written by Brett is suitable to my requirements. He had exactly same requirements for his firm. Well! I got some a starting point. Here I want tell you that I am novice in Perl script J

Day 1
Now task to customize the migration script according to our setup. As usual, initial failures the subversion guy who gave us the training didn’t configure the subversion for different projects, there was many things to set before this script to run such as project wise authentication and authorizations.

Day 2
The migration script written by Brett need few modules to be installed for Perl; which are not mentioned.Modules are: * DBI * Time::ParseDate (install "Time-modules" from PPM) * File::Path * Win32::TieRegistry

Here need to mention that the log file (migrate.log) generated by the migration script helped me to fix the issue the customization issues.

Another issue: The migration script is using command line checkout from VSS. We never ever used command line to check out a file from VSS.

The command to get file from VSS used by script:

"\ss.exe" get -GTM -W -I- -GL"" -V1 /"

Got the help from MSDN on ss command where as for more options like –GTM and –GL went further deep in to MSDN itself. Add new environment variable SSDIR with the VSS repository location.

Very first time I have seen a inital success when the files started getting from VSS and were trying to add in to subversion repository. Failed with authentication error because I had created user with all lower case where as script was trying with Sentence case. Huh! I got a smile and started looking for a function in Perl which will convert user name to lower case.

Day 3
Got it
J very small thing for the Perl champs but for me getting the function lc EXPR which actually Returns a lowercased version of EXPR, solved the issue.
Change in script:

1. $user = lc $user;

2. svn --non-interactive checkout --username $user --password $user \"$REPOS/$basedir\" \"./work/$basedir\""

3. svn commit --non-interactive --non-recursive --username $user --password $user --message $comment \"$'\"";


Before I tell you the migration result, I should mention that there are four primary phases in the migration run:

A. Building Directory Hierarchy

Determines the directory structure of the project in VSS

B. Building File List

Determines the list of all 'live' files in the VSS project

C. Building File Histories

Determines all version information, time/data information, user information, and checkin comments for all files identified in step 2

D. Extract and Import

Extracts files one-by-one, version-by-version, from VSS and checks them into Subversion

Migration Started:

Building directory hierarchy: done (1519 dirs)

Building file list (100%): done (3863 files)

Building file histories (100%): done (4122 versions)

Creating local directories: done

Importing directories: done

Checking out directories: done

Extracting and creating (100%): js (v.1)

and end with sucess....... a big success for me...