Archive for June, 2008

Full Git Clone of JRuby Repository

Saturday, June 21st, 2008

While I was at it with making a full git clone of Matz Ruby repository I also created a full clone of JRuby subversion repository and posted it on my GitHub account for your enjoyment:

Full Git Clone of JRuby Subversion Repository.

This repository has all the tags and most branches. As with Matz Ruby repo, it is being updated hourly. Personally, I find Git much more convenient to work with, especially when I don’t have commit rights to the repository, but still can make local patch queues and local branches. See my earlier entry on the topic: “Using Git for Ruby/JRuby development“.

Full Git Clone of Matz Ruby Subversion Repository

Thursday, June 19th, 2008

I’ve been wanting to have a full git clone of Matz Ruby Subversion repository for a while. In fact, I’ve been using a private git clone for a few months already, and really like the speed of switching between branches and immediate history search. This all gets really handy with current explosion of different versions of Ruby (1.8.5, 1.8.6 with more than 200 patch-levels, 1.8.7, 1.8-dev, 1.9). Using all these different versions is essential when writing the new RubySpec tests.

And since now more folks than ever are writing the RubySpecs, dealing with Subversion gets painful for many, and the public Git repository of Matz Ruby is going to address that. So here it is:

Full Git Clone of Matz Ruby Subversion Repository.

For more info on how to use, take a look at the README. In a nutshell, just clone the repository, create local tracking branches for those remote branches that of interest to you, and keep updating your repository periodically.

And for those who’d like to know the steps in order to repeat them on other Subversion repositories, read on.

First, I fully cloned the entire Matz Ruby Subversion repo, using git svn:

   1: git svn clone --stdlayout http://svn.ruby-lang.org/repos/ruby

Then, I created an empty git repository on GitHub. So far, pretty standard procedure. The only tricky part was to figure out how to push remote branches from my freshly svn-cloned repository to public branches in GitHub’s repository. Without this, it would be pretty complicated to keep all the branches updated (you’d need to create local branches, update them manually, one by one, and then push them).

Luckily, git’s flexibility allows to do all kinds of interesting things, sot it was easy to write some config entries to “re-wire” remote branches in local repository to public branches in  the GitHub’s one, I had to adjust the .git/config file:

   1: [remote "origin"]
   2:    url = git@github.com:vvs/ruby-mirror.git
   3:    push = refs/remotes/trunk:refs/heads/trunk
   4:    push = refs/remotes/ruby_1_8:refs/heads/ruby_1_8
   5:    push = refs/remotes/ruby_1_8_7:refs/heads/ruby_1_8_7
   6:    push = refs/remotes/ruby_1_8_6:refs/heads/ruby_1_8_6
   7:    push = refs/remotes/ruby_1_8_5:refs/heads/ruby_1_8_5
   8:    push = refs/remotes/ruby_1_6:refs/heads/ruby_1_6
   9:    push = refs/remotes/ruby_1_4:refs/heads/ruby_1_4
  10:    push = refs/remotes/ruby_1_3:refs/heads/ruby_1_3
  11:    push = refs/remotes/tags/*:refs/tags/*

With that change, every push to the “origin” repository (the GitHub one) will push remote branches in my private repository to the public branches of GitHub repository.

Finally, the process to keep the repository up-to-date is now straightforward:

   1: git svn fetch --all # fetches ALL branches from svn repo
   2: git push            # pushes all branches to public git repo

Update: The repository has been moved from my personal GitHub account to the RubySpec GitHub account, to compliment the currently existing RubySpec and Mspec repositories there.

Note #2: Nick Sieger has a JRuby’s git clone (only for the main trunk though): http://github.com/nicksieger/jruby