Migrate CVS to SVN with cvs2svn

Well, as it usually happens with stuff I do, it gets out of the “ordinary”. It almost never gets easy enough.

So, this time, cvs2svn. Great litle tool. Only problem is that in my centos 5.5, the subversion I installed for some reason I don’t remember and didn’t bother spending time figuring out, it created a repository based on sqlite or something. In any case, the repository and the projects are not directories, as happens in most or all examples on cvs2svn out there.

So, since you can’t use svn2cvs on local repository as in the tutorials, I searched for a way to use it to migrate to a … “remote” repository 🙂

And I eventually found this: http://ptspts.blogspot.com/2009/06/how-to-migrate-or-merge-cvs-or-svn.html

Looked promising. I made the dump and then figured I have to install the svn-pusher. Obviously, I got

[root@Impuls ~]# apt-get install libsvn-core-perl
Reading Package Lists… Done
Building Dependency Tree… Done
E: Couldn’t find package libsvn-core-perl

So, I did a yum search push and found

perl-SVN-Push.noarch : Push Repository to Remote Subversion Repository

trying to install that, failed with dependency check on subversion perl:

subversion-perl-1.4.6-jason.1.i386 from utterramblings has depsolving problems
–> Missing Dependency: subversion = 1.4.6-jason.1 is needed by package subversion-perl-1.4.6-jason.1.i386 (utterramblings)
Error: Missing Dependency: subversion = 1.4.6-jason.1 is needed by package subversion-perl-1.4.6-jason.1.i386 (utterramblings)
You could try using –skip-broken to work around the problem
You could try running: package-cleanup –problems
package-cleanup –dupes
rpm -Va –nofiles –nodigest

next:

[root@Impuls ~]# yum erase subversion-perl
Setting up Remove Process
No Match for argument: subversion-perl
Package(s) subversion-perl available, but not installed.
No Packages marked for removal

after some hours of digging around I learned that this is because I already had installed the subversion.1.6.13-0.1.el5.rf so removing that and the svn_web_dav with yum and then installing subversion and svn_web_dav and perl-SVN-Push solved everything. Then I tried cpan with svn-pusher and that finally worked.

then came the migration:

[root@Impuls db]# svnadmin load –parent-dir delphi /svn/ < /launcher.dump
svnadmin: Expected FS format ‘2’; found format ‘4’

a little digging around showed the cause: I previously had installed a newer version of subversion and created the repository with it. now, since I downgraded, it was no longer supported. Crap.

So, uninstall the jason version subversion and reinstall the previous one. But … there is no sense in doing that from the cd/dvd as I’d end up in the same situation. So I searched the net a bit for the rpm version I had looking for a source that had all my needed dependencies and finally found : http://packages.sw.be/subversion/

installed everything and voila:

svnadmin load –parent-dir delphi /svn/ < /launcher.dump

worked without errors.

But, as I already told y’all, in my case nothing is *that* simple. And here’s again why: I don’t use trunk/branches/tags or any other such structure for my projects. And that’s because I wrote them all, they are pretty small and until now I never needed this structure. And of course, I hate having 2 empty dirs in all my projects (branches and tags) plus an unneeded nesting level (tags).

So, what to do. I first wanted to cancel the import but when I saw that you need to “hack” things in order to remove the stuff without anybody ever knowing about it (given that I am the only person using my repository it’s a bit too paranoid even for me) I decided to just make 3 new revisions by deleting the “offending” directories and re-create the dump properly.

I then tried

cvs2svn –trunk-only –username=ciuly –trunk=Launcher –branches=Launcher/branches –tags=Launcher/tags –dumpfile=/launcher.dump /cvs/delphi/Launcher/

obviously, errored.

A bit of thinking and looking in the dump file got me an idea: modify the cvs2svn to NOT create the branches and tags directories when dumping 😀 And this time it was damn easy too. I only searched for a few things and in less than 5 minutes I got to modify the svn_run_options.py on line 467 and removed branches_path and tags_path from the initial_directories array. Ta-Da.

now running

cvs2svn –trunk-only –username=ciuly –trunk=Launcher –dumpfile=/launcher.dump /cvs/delphi/Launcher/

properly produced the desired dump file for importing into my svn repo suitable for my structure with

svnadmin load –parent-dir delphi /svn/ < /launcher.dump

complete with history. Only “issue” was that in cvs I used the user “impuls” where as in svn I changed it to “ciuly”. And the history kept it as impuls. Not a big deal after all. That can be changed too 😀 But I don’t have time right now for such minor issues. I have to finish moving my cvs to svn properly.

And I didn’t even need that svn pusher thing. damn 🙂

PS: now, when I’m finished, I realized that the reason why I thought I have to do a remote svn import was because I had an error in my svnadmin load command line. oups 😀

Related posts

Tags: , ,

Leave a Reply

This blog is kept spam free by WP-SpamFree.