You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by "Jens B. Jorgensen" <je...@tallan.com> on 2003/11/07 15:20:53 UTC

a basic vss2svn.py

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

Re: a basic vss2svn.py

Posted by "Jens B. Jorgensen" <je...@tallan.com>.
Ok, well since someone's already taken an interest in extending the 
functionality I set up a little repository (svn 0.28.2) to hold this 
beast. Also, since someone had a problem with ActivePython 2.3 and in 
particular its COM support I made some changes that work around that. 
The latest update can be had at:

https://chidb01.tallan.com/vss2svn/trunk/vss2svn.py

Jens B. Jorgensen wrote:

> 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: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: a basic vss2svn.py

Posted by "Jens B. Jorgensen" <je...@tallan.com>.
Ok, well since someone's already taken an interest in extending the 
functionality I set up a little repository (svn 0.28.2) to hold this 
beast. Also, since someone had a problem with ActivePython 2.3 and in 
particular its COM support I made some changes that work around that. 
The latest update can be had at:

https://chidb01.tallan.com/vss2svn/trunk/vss2svn.py

Jens B. Jorgensen wrote:

> 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

Re: a basic vss2svn.py

Posted by Christian Stork <cs...@ics.uci.edu>.
On Fri, Nov 07, 2003 at 05:30:01PM -0800, Eric Hanchrow wrote:
> 
> I've tried revision 4 on our repository, and it always pukes while
> generating the svn_dump file:
> 
>     starting revision with {'svn:log': 'fix bugs in collision checking', 'svn:author ': 'Meg', 'svn:date': '2003-10-28T22:48:54.000000Z'}
                                                                                     ^^^
This doesn't look right.

HTH,
Chris

-- 
Chris Stork <><><><><><><><><><><><><>  http://www.ics.uci.edu/~cstork/
OpenPGP fingerprint: B08B 602C C806 C492 D069  021E 41F3 8C8D 50F9 CA2F

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: a basic vss2svn.py

Posted by "Jens B. Jorgensen" <je...@tallan.com>.
Ahh, ok. Interesting. I've never used this VSS feature and hadn't 
realized it existed. This shouldn't be hard to fix but the question is 
what the program should do. I'm guessing that the version log is kept 
just not the actual file so what version should we put in the 
repository? Any? We probably need some version so if you checked out the 
repository for that point in time or that revision you'd have /some/ 
version of the file (and indeed the latest may be fine for you since you 
elected to store only the latest version in the repository). Does this 
make sense to you?

Eric Hanchrow wrote:

>Here's another report from the front lines.
>
>Revision 8 seemed to get much further along than did revision 4 (the
>last one I tried).  At least, it ran for much more wallclock time --
>an hour or more (I got bored and went home, so I don't know how long
>it ran).
>
>However, it too died, like this (this is an attachment, rather than
>inline, since the lines are long and my mailer would complain if it
>were inline):
>
>
>  
>
>------------------------------------------------------------------------
>
>Created $/development/vhti/bindings/perl/examples/auth0.xml
>Traceback (most recent call last):
>  File "vss2svn.py", line 479, in ?
>    dumper.add_or_change_file(rev_item)
>  File "vss2svn.py", line 339, in add_or_change_file
>    rev_item.vssitem.Get(fname)
>  File
>  "c:\DOCUME~1\erich\LOCALS~1\Temp\gen_py\2.3\783CD4E0-9D54-11CF-B8EE-00608CC9A71Fx0x5x1.py", line 254, in Get
>    return self._ApplyTypes_(10, 1, (24, 32), ((16392, 51), (3, 49)),
>    'Get', None,Local, iFlags)
>  File "D:\Python23\lib\site-packages\win32com\client\__init__.py", line 445, in _ApplyTypes_
>    return self._get_good_object_(self._oleobj_.InvokeTypes(*((dispid, 0, wFlags , retType, argTypes) + args)), user, resultCLSID)
>pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'SourceSafe', 'File auth0.xml does not retain old versions of itself', 'ssusexp.hlp', 10607, -214 7166575), None)
>  
>
>------------------------------------------------------------------------
>
>
>For what it's worth, the file it was chewing on has SourceSafe's
>"Store only latest version" flag set, but it might not have had that
>flag set when it was first created.
> 
>  
>

-- 
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

Re: a basic vss2svn.py

Posted by Eric Hanchrow <of...@blarg.net>.
Here's another report from the front lines.

Revision 8 seemed to get much further along than did revision 4 (the
last one I tried).  At least, it ran for much more wallclock time --
an hour or more (I got bored and went home, so I don't know how long
it ran).

However, it too died, like this (this is an attachment, rather than
inline, since the lines are long and my mailer would complain if it
were inline):


Re: a basic vss2svn.py

Posted by "Jens B. Jorgensen" <je...@tallan.com>.
Eric Hanchrow wrote:

>I've tried revision 4 on our repository, and it always pukes while
>generating the svn_dump file:
>
>    starting revision with {'svn:log': 'fix bugs in collision checking', 'svn:author ': 'Meg', 'svn:date': '2003-10-28T22:48:54.000000Z'}
>    Traceback (most recent call last):
>      File "d:/cygwin/home/erich/vss2svn.py", line 404, in ?
>        raise RuntimeError('cannot handle (type %s) (%s)(%s)' % (item.Type, rev_item.path, ver.Action))
>    RuntimeError: cannot handle (type 0) ($/development/vhti_internal/src/tabulation) (Checked in $/development/vhti_internal/src/tabulation)
>
>I have no idea what the problem is (OK, I have an idea, but it's so
>vague and ill-informed that I won't mention it unless somebody
>actually wants to know).  I know nothing about ActiveX, and hardly
>anything about Subversion.  Any suggestions as to how we can
>investigate this?
>
>  
>
This is weird. In the first pass when it iterates over the repository it 
should skip "Checked In..." Actions on a directory. Having done that it 
won't later encounter them as happened above. Also that space in 
'svn:author ' above is kind of suspicious. I checked the script and that 
space does not exist in the script. Is it possible you somehow got a 
munged copy of the script locally? Here's a checksum of the copy I have:

$ md5sum vss2svn.py
a2858a562ecd7e4480fb0781596053bf *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

Re: a basic vss2svn.py

Posted by Eric Hanchrow <of...@blarg.net>.
I've tried revision 4 on our repository, and it always pukes while
generating the svn_dump file:

    starting revision with {'svn:log': 'fix bugs in collision checking', 'svn:author ': 'Meg', 'svn:date': '2003-10-28T22:48:54.000000Z'}
    Traceback (most recent call last):
      File "d:/cygwin/home/erich/vss2svn.py", line 404, in ?
        raise RuntimeError('cannot handle (type %s) (%s)(%s)' % (item.Type, rev_item.path, ver.Action))
    RuntimeError: cannot handle (type 0) ($/development/vhti_internal/src/tabulation) (Checked in $/development/vhti_internal/src/tabulation)

I have no idea what the problem is (OK, I have an idea, but it's so
vague and ill-informed that I won't mention it unless somebody
actually wants to know).  I know nothing about ActiveX, and hardly
anything about Subversion.  Any suggestions as to how we can
investigate this?

-- 
This movie doesn't scrape the bottom of the barrel.  This movie isn't
the bottom of the barrel.  This movie isn't below the bottom of the
barrel.  This movie doesn't deserve to be mentioned in the same
sentence with barrels.

        Roger Ebert on "Freddy Got Fingered"


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org