Migrate a svn-trac development setup to git January 6th, 2009

I got tired of svn for my rails development, because most of the rails community has moved to git, and it gets very hard to manage the vendor dependancies —and also rails edge— which are on a git repository while you are using a svn repository.

I heard of Piston. I used to use Piston a lot and it is great to track the vendor branches under svn, but it just doesn’t play well with the git vendor branches. Piston 2 should fix this though, but to date, its development is at an early stage.

So well, I heard git ain’t too bad either. And Braid allows to do the same than Piston with git repositories. Migrating svn to git was painless, I had a bit more difficulties making trac work nicely with git, so I wrote some notes about it.

Migrate svn

It’s easy. First create a users.txt file to map your svn users with your git users.

vim users.txt

And type:

edouard = Edouard Briere
anotheruser = Another Name

Then, you will need to actually install git and git-svn.

sudo apt-get install git git-svn

Then run the folowing commands:

mkdir my_project_git_svn
cd my_project_git_svn
git-svn init http://url.to.your.svn.project.com/trunk/ --no-metadata
git config svn.authorsfiles ../users.txt
git-svn fetch

That’s it! We just created a temporary git-svn repository. git-svn is now fetching all the svn changesets and import them into the new git repository. It can take quite some time, depending on the size of your project.

Now, we don’t want a git-svn repository but a git repository. Let’s change this.

git clone my_project_git_svn my_project_git

Done! You can now clean up. I kept my old svn repository, but I guess you can delete it if you wish, you can delete the git-svn repository for sure, you won’t need it.

rm -rf my_project_git_svn

Setting up trac 0.11

Now, configuring trac is not as fun. First, get the GitPlugin.

cd ~/src
svn co http://trac-hacks.org/svn/gitplugin
cd gitplugin/0.11
export PYTHONPATH=~/lib/python2.5/site-packages:$PYTHONPATH
python setup.py install

Go to your trac project directory. I put mine in /var/lib/trac/my_project. Edit your conf/trac.ini as such:

[components]
tracext.git.* = enabled
[trac]
repository_dir = /path/to/repository/your_project/.git/
repository_type = git
[git]
cached_repository = true
persistent_cache = true
shortrev_len = 6
git_bin = /usr/bin/git

Then, you need to resync the trac changeset cache against your repository

sudo trac-admin translator resync
and restart Apache. sudo apache2 -k restart. And voilà!

May be useful

Git for SVN users crash course

/ Tags: System, trac, svn, git Trackback

Recipe: Julköttbullar (Christmas meatballs) December 26th, 2008

Ingredients for 4 persons

  • 500 grams of mincemeat
  • 0,75 dl of oat
  • 1 large spoon of potato flour
  • 1 dl of water
  • 1 egg
  • 1 onion
  • 1 tea spoon of salt
  • 1 large spoon of black pepper
  • 1/2 large spoon of allspice
  • 0,5 dl of cream

Preparation

  1. Mix oat, potato flour, water and cream and let it rest for 10 minutes.
  2. Add the egg, the onion salt, pepper and spices. Mix by hand until it becomes some kind of dough.
  3. Shape the meatballs, and cook them in a frying pan with butter
/ Tags: Recipes, Sweden Trackback

Autumn, Autumn November 30th, 2008

Today was gloomy and rainy. That’s fine if you like to take pictures of gloomy and rainy autumns. The snow we had last week had melt so we decided to go for a walk in a forest nearby, it was nice.

Autumn

We came across a forest and a lake, which is not an uncommon thing in Sweden.

Autumn

The lake was really nice, and nobody was around.

Autumn

/ Tags: Photography, Sweden Trackback

Let me Google that for you November 22nd, 2008

Finally, Google for your mum. Let me Google that for you is ace.

Trackback

As real as it gets November 12th, 2008

I love it.

Trackback
Next →