01 March, 2009

From CVS to GIT in three easy steps

The first step in our little CVS to GIT experiment is to prepare the GIT repositories on a local machine (e.g. my laptop) before posting them to a server.

Someone recommended cvs2git to do this, but I couldn't get the tool to do what I wanted simply and I gave up after half an hour, switching to using git-cvsimport instead. The latter is part of the git core binaries and a lot easier to use in my case.

1. Get a local copy of the CVS repository:

While it is possible to use git-cvsimport to perform the conversion over the network, this is terribly slow. It is much more efficient to retrieve a copy of your CVS repository onto your local machine, and perform the conversion there. It will literally save your hours.

Fortunately, the FreeType sources are located on Savannah servers, whose admins are smart, so getting this local copy through rsync is trivial:
mkdir /tmp/prep
cd /tmp/prep
rsync -avz rsync://cvs.sv.gnu.org/sources/freetype .
After less than 2 minutes, a complete copy of the full CVS repository is on my /tmp/prep/freetype directory.

2. Adjust your copy's configuration:

Depending on the way your CVS repository was managed on the original server, you may need to change your copy's CVSROOT/config file. For example, mine had the following lines:
# Put CVS lock files in this directory rather than directly in the repository.
LockDir=/var/lock/cvs/sources/freetype
Here, the LockDir pointed to a Savannah-specific lock directory that didn't exist on my machine. This caused a weird error message later when calling git-cvsimport. It took me a few tries to guess that this was the problem, and I simply commented the LockDir line to solve it.

Your own configuration might be more complex. Have a look at it first, and in doubt, simply comment any suspicious line with a weird path in it.

3. Convert your modules into git repositories:

With FreeType, each CVS module has its own ChangeLog and history, so it's only logical to convert each one of them into a different git repository. For example, to convert the "ft2demos" CVS module into a git repository called "freetype2-demos.git", one can do:
export CVSROOT=/tmp/prep/freetype
git-cvsimport -v -i -a -C /tmp/prep/freetype2-demos.git ft2demos
Note the options used here:
-v => enable version operations

-i => import only (we don't want to create an index and working sources at the destination)

-a => import everything (instead of the default less-than-10-minutes-old commits)

-C <path> => specify target git directory
Note that in theory, you could use the option "-d /tmp/prep/freetype" to specify the CVS root directly;however for some reason this caused errors in cvsps, the tool program invoked by git-cvsimport. So try to define the CVSROOT in your environment instead.

After a few minutes, you'll get a shiny git repository in /tmp/prep/freetype2-demos.git/.git

I also did it for two other modules:

git-cvsimport -v -i -a -C /tmp/prep/freetype2.git freetype2
git-cvsimport -v -i -a -C /tmp/prep/ftjam.git jam

Next episode, how to setup the server and copy our fresh git repositories to it...

FreeType CVS to GIT experiment

I recently tried to migrate the FreeType CVS server to Git as an experiment. I wanted to see how easy it was to setup, on a single machine the following:

  • a git repository hosting a copy of the official CVS FreeType repository. Preferably with gitosis for ease of setup and administration.

  • a git server able to handle the git:// transport directly.

  • a gitweb interface to present a nice web-based interface to the repository, as well as allow for the http:// transport when accessing the git sources.
It turned out in the end to be much more challenging that I initially though but the end result is now available here: http://git.freetype.org

WARNING: since this is an experiment, this is not a real-time copy of the official CVS repository and probably lags behind it by a few commits.

In the hope that some of my musings might be useful to other enthusiastic developers, I'm going to publish on this blog the steps that were required to get there, with pitfalls and all. Stay connected for the details...

18 June, 2007

ClearType patents clarifications

I've written a small document to clarify the relationships between FreeType, the Unix desktop and the ClearType patents. it's available here.

Now, if the Xft / Cairo maintainers would integrate my patches, or something like these, I would be much happier. I mean, I only released them 8 months ago !!