Getting a list of authors

First thing was to get a list of users who have committed to SVN. We need this to create an authors file mapping the SVN users to Git users.

$ svn log --quiet https://pegasus.isi.edu/svn/pegasus | grep "^r" | cut -d'|' -f2 | sort | uniq

After a few minutes it gives a list. After that, I tracked down all those people and created a file that looks like this:

akumar = Atul Kumar <akumar@isi.edu>
byun = Eun-kyu Byun <byun@isi.edu>
cgsmd1 = Gaurang Mehta <gmehta@isi.edu>
cward = Craig Ward <cward@isi.edu>
dang = Daniel Gunter <dkgunter@lbl.gov>
dkgunter = Daniel Gunter <dkgunter@lbl.gov>
fabio = Fabio Silva <fabio@isi.edu>
gideon = Gideon Juve <gideon@isi.edu>
gmehta = Gaurang Mehta <gmehta@isi.edu>
ksb = Keith Beattie <KSBeattie@lbl.gov>
mayani = Rajiv Mayani <mayani@isi.edu>
prasanth = Prasanth Thomas <prasanth@isi.edu>
rubing = Rubing Duan <rubing@isi.edu>
rynge = Mats Rynge <rynge@isi.edu>
smithd = David Smith <smithd@isi.edu>
vahi = Karan Vahi <vahi@isi.edu>
voeckler = Jens Vöckler <voeckler@isi.edu>
wchen = Weiwei Chen <wchen@isi.edu>
wmullins = Bill Mullins <bill.mullins@live.com>
(no author) = Pegasus <pegasus-support@isi.edu>

Notice that "(no author)" is mapped to Pegasus. That is a result of the original CVS-SVN conversion, which lost some authorship info.

I saved the list in a file called /tmp/authors.txt

Converting from Subversion to Git

For this step I used a tool called svn2git, which is a wrapper around "git svn" that automates some of the stuff about creating branches. 

It all boils down to something like this:

$ sudo gem install svn2git
$ mkdir pegasus
$ cd pegasus
$ svn2git --verbose --authors /tmp/authors.txt https://pegasus.isi.edu/svn/pegasus

Cleaning up

svn2git leaves a bunch of cruft in the repository. I just cleaned that stuff manually.

First I had to remove some of the branches:

$ git branch -D monitord@3333
$ git branch -D bill-doc@3339
$ git branch -D pmc_io@5545 
Next, I removed the remote tracking branches for svn:
$ git branch -a | grep remotes/svn | sed 's,remotes/,,' | xargs git branch -d -r
Next, I removed the configuration entries related to the tracking branches by editing .git/config.

Finally, I removed any trace of svn in the .git directory:
rm -rf .git/svn .git/refs/remotes/svn

Creating .gitignore files

Unfortunately, we need to create a bunch of .gitignore files to ignore all of the files that were ignored by svn:ignore properties in Subversion.

First, I got a list of the entries from my svn repository and saved them to a file:

$ cd SVN_REPO
$ svn propget svn:ignore -R > ignores
Next, I wrote a script called svn2git-ignore (attached) that created the .gitignore files:
$ cd GIT_REPO
$ svn2git-ignore SVN_REPO/ignores
$ git add .
$ git commit -m "Add .gitignore files"

Pushing to GitHub

Finally, I pushed everything to my GitHub repository, which I created on GitHub.com:

$ git remote add origin git@github.com:pegasus-isi/pegasus.git
$ git push origin --all
$ git push origin --tags
  • No labels