Tag: git

Contributing to QGIS using git-svn

03.03.2011 20:23 ·  GIS  ·  qgis, git

At the last QGIS developer meeting in Wrocław we discussed the migration from SVN to Git. There was even a small workshop on using Git at the hackfest. The final decision on this topic has not yet been made, but it will be discussed again at the next meeting in Lisbon.

For those who want to try Git in action, there are several QGIS mirrors on GitHub (one, two) that can be used for development. Gary Sherman has written a good post on how to do this.

Another option is to use git-svn. This eliminates the need to create an account on GitHub and is a good option if you just want to try Git but still want to use your SVN working copy for a while. This is the option I chose.

First, we need to obtain sources, starting with some revision

git svn clone --revision 15000:HEAD https://svn.osgeo.org/qgis/trunk/qgis qgis

If necessary, revision 15000 can be replaced with another revision. Now you can cd into the qgis directory and use all the features of git: create local branches, make and commit changes, etc. When everything is ready to be committed back to trunk, use the following command

git svn dcommit

To synchronise with the repository, use

git svn rebase

I’ve already made my first commit this way.

Migrating from SVN to Git

25.11.2010 19:03 ·  Notes  ·  git, svn

After reading manuals and smart books, I decided to migrate some of my local SVN repositories to Git. It would seem to be a simple process, but no… there were some problems.

I’m running DeepStyle 3.1 (which is basically Slackware 12.2). Git 1.6.1.3 was installed with the system.

So I created a directory for the project, ran git-svn and got a “command not found” error. The first problem turned out to be quite simple, you have to use git-svn (at least on Slackware), i.e. without the hyphen. Strange, almost all articles refer to git-svn

OK, I tried to run the correct command and got a scary error message

Can't locate Error.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i486-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/5.8.8/i486-linux-thread-multi /usr/lib/perl5/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i486-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl .) at /usr/lib/perl5/vendor_perl/5.8.8/Git.pm line 93.
BEGIN failed--compilation aborted at /usr/lib/perl5/vendor_perl/5.8.8/Git.pm line 93.
Compilation failed in require at /usr/bin/git-svn line 45.
BEGIN failed--compilation aborted at /usr/bin/git-svn line 45.

This one took a bit longer. It turned out that I needed to install additional Perl modules and the corresponding bindings for SVN. To install the modules, use the following command (internet access required):

sudo cpan Alien::SVN Error Term::ReadKey

Wait for the installation to finish. Now download subversion-bindings SlackBuild. Extract the archive, change the SVN version in the script to the one you are using and run it. Wait for it to compile and then install the package that was created. Everything should be working now.

The actual repository migration is quite simple (at least in my case). First, we need to match the usernames in SVN and Git, so we create a text file with the following content (of course, the names should be real):

jdoe = Jon Doe
tomm = Tom Morton

Then create a temporary directory for the project, initialise the Git repository, and import the sources from SVN:

mkdir project_tmp
cd project_tmp
git svn init http://svn.somehost.net/project --no-metadata
git config svn.authorsfile ~/tmp/svn_authors
git svn fetch

The --no-metadata switch in the third command is needed to ignore SVN-specific information. The fourth command creates a mapping between Subversion and Git usernames using a previously created file. The last command performs the import of the source code. The import process will take some time (depending on the size of the repository and the number of commits). Once it has finished, you can clone the temporary repository to get rid of any garbage left behind by SVN.

cd ..
git clone project_tmp project