I have been looking for easy and quick solution to mirror Subversion repositories in Git at GitHub. With bit of reading and testing, I came up with some quite usable workflow. But, most likely due to my lack of Git fu, I wasn’t happy with it. Especially, could not find how to update Git mirrors from various locations and computers, also to allow others to do that.
Lately, I have found a tool written in Ruby by Eloy Durán. It is git-svn-mirror - a command-line tool that automates the task of creating a Git mirror for a SVN repository, and keeping it up-to-date. I installed Eloy’s tool from Ruby gems and played with it for a while. I really liked it.
I skimmed the Ruby code of git-svn-mirror
and found out it makes use of bare repositories in Git. A Git bare repository stores just the contents of the .git
directory, without any files checked out around it. Long story short, this script does almost exactly what I need and if there is something it does not do, then I can add it.
I have never written a single line of code in Ruby and I don’t feel like I need to learn it now. So, I decided to port git-svn-mirror to Python. I have just pushed pygit-svn-mirror 0.1 based on git-svn-mirror 0.1 to the repository at GitHub. I have tried to follow command line interface and overall code structure of the original version in Ruby. I have also preserved the original license and Eloy’s copyright.
There is README.md file included with detailed guide on how to use the pygit-svn-mirror
. Basically, there are two commands: init
and update
. For each command, --help
option will display required and supported arguments.
For example, creating mirror of Subversion repository of PROJ.4 project at GitHub involves the following commands:
$ mkdir /path/to/proj4/mirror
$ cd /path/to/proj4/mirror
$ git-svn-mirror.py init \
--from=https://svn.osgeo.org/metacrs/proj/ \
--to=git@github.com:<USRNAME>/proj.4.git
and to update the mirror from its workbench directory:
cd /path/to/proj4/mirror
git-svn-mirror.py update
or from any folder but with workbench location pointed explicitly:
git-svn-mirror.py update -w /path/to/proj4/mirror
Feedback, bug reports and patches highly appreciated.
Finally, big thanks to Eloy Durán for the original git-svn-mirror written in Ruby.