[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

a basic vss2svn.py

From: Jens B. Jorgensen <jens.jorgensen_at_tallan.com>
Date: 2003-11-07 16:20:53 CET

Ok, I finally got around to creating a basic VSS to svn conversion
script. Before anyone gets too excited let me state that my script
*only* handles the creation of directories and the creation and checkins
of files. Renames, deletions, etc. are simply ignored. With some work
this stuff could be added but I am neither motivated (my current client
decided to move to ClearCase) and definitely don't have time.

I started by looking at cvs2svn.py. For a little while I thought about
abstracting out some operations so perhaps they could share a module.
Then I decided that since I was only going to support the most basic
operations I would just be happier hacking out the bits of logic I
needed from cvs2svn.py that deal with creating the svn dump file. And
this is what I did.

The basic strategy is to use the VSS COM interface (you'll need the
win32all extensions) to iterate through the tree and on each node
(directory/file). For each node I iterate through the "Versions"
collection and skipping Actions like rename, move, label, etc. etc. I
end up writing for each Created or Checkin action a line containing the
timestamp, a hash of the username and comments, the revision number and
the path. This follows the same idea as cvs2svn.py. I next sort that
file externally using the sort command so you'll need cygwin or you'll
need to accomplish this in some other way. I then read in this file and
as I go through it I check to see if subsequent entries have the same
hash over username/comments and are within a configurable time margin.
If that's true then those events are counted together in a single
revision. This does a decent job of capturing 'logical' commits you've
made to vss into a single svn revision.

The outcome of the script is an svn dump file named 'svn_dump' which you
can then load into a fresh repository.

So, for all those that want to convert their vss repositories into svn
go ahead and take a crack at this. Note that it is certainly possible to
capture all of the VSS history including file renames, deletions, moves,
etc. but I just didn't want to spend the time doing this. This would be
not quite straightforward to do but if you're determined... Anyhow to
use the script you'll need to edit it to change the hard-coded values
for the repository path etc. which are all at the top of the script.

If you find bugs or make enhancements let me know. And last but not
least the script may be had from the following URL.

http://pitroda.net:8000/~jbj1/vss2svn.py

-- 
Jens B. Jorgensen
jens.jorgensen@tallan.com
"With a focused commitment to our clients and our people, we deliver value through customized technology solutions."
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Nov 7 16:23:51 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.