Thursday, May 24, 2007

Committing a project under bzr to a svn subtree

Using subversion is kind of painful for my personal projects, mainly because :
  1. I do not have a root account on my workstation, and I cannot run a subversion sever on it
  2. I have only a pure http available for my university webpage, and as such, I cannot serve any subversion non locally.
I am using for some time bzr, which is a decentralized source version control. I started using it a few months ago because I found bzr really easy to use, and as it does not require anything else than http, I can serve my projects from the university.

Now, when I want to submit some of those projects to subversion repositories, it is a problem. There is bzr-svn, which is a plugin able to understand svn repositories, and put its metadata under bzr control. Unfortunately, I could not use it to submit one of my projects as a module of an existing subversion server (maybe because I do not know much about source control systems). This is where tailor comes in: " Tailor is a tool to migrate changesets between ArX, Bazaar?, Bazaar-NG, CVS, Codeville?, Darcs, Git, Mercurial, Monotone, Perforce, Subversion? and Tla? repositories." (the main page of the project, as far as I can tell, is there).

I first used the last release of tailor, but it did not work quite well, and after some time, I finally understood it was because of desync between the tailor version and my version of bzr. Anyway, after fetching the last published sources, I could tranlate my bzr project to subversion. Here are the steps:
  1. I assume there is a subversion repo http://svnrep, to which I want to commit my project.
  2. I want to put it in http://svnrep/mainproject/trunk/foo.
  3. My bzr project is in $HOME/foo.bzr
I first generate the tailor config file for this convertion as the following:

tailor --verbose --source-kind bzr --target-kind svn \
--repository $HOME/foo.bzr \
--target-repository svn://svnrep/ \
--subdir tmp \
--target-module trunk/foo bzr2svnproj > svn2bzrproj.tailor

subdir tmp means that tmp will be the working directory. Then, the actual convertion is done using the commands:

tailor -D -v -c floupi.tailor

It works for 2 of my projects which are not big (a few tens of source files and revisions), so I don't know if this can be used for bigger projects easily.

No comments: