cyv: syncing git and svn

For codeyard I’m developing cyv, which is a (still quite specific) util (written in Python!) to keep svn and git repo’s in sync. On the serverside, at least. First, let me explain what exactly is synced.

When someone commits to a svn repo, the git repo is synced with git-svn. You can just clone the git repo and git pull instead of having to use git-svn yourself.

When pushing commits to the git repo on a branch that came from the svn repo, the commits are git-svn dcommit-ed. If it fails (svn doesn’t do merges that well), it’ll revert the updates and will receive the successful part of the dcommit on the next post-commit triggered fetch from the svn repo. The user will have to git-pull and fix the commits locally: the git manner.

If pushes don’t involve the svn backed branches, it won’t have any unusual side-effects. This allows for pushing and pulling of topic-branches separate from svn and pushing them, when mature enough, into subversion without ever having to hassle (as much) with git-svn.

An obvious huge advantage is that a git-clone of the git repo is a hell of a lot faster than a git svn clone. A second big advantage is that someone can choose to either use git or svn himself while not mutually excluding the other. This is of special concern to codeyard, where projects should be accessible to everyone: beginners and advanced. If instead we offered fully separated git repositories, the projects that prefer git would become inaccessible for most. And if we wouldn’t offer git repos, people would set them up themselves elsewhere, for they really don’t want to bother themselves with git-svn.

cyv contains some neat features. One I want to highlight is the cyv-layout file, you can place in the root of the svn repo. It tells cyv how the repository is laid out. Eg:

branches/*: branches/*
tags/*: releases/*
some-git-branch: some/path/in/the/svn/repo

Another one is a wrapper around git-shell to have per repository permissions for different users depending on their ssh pub key.

To reiterate, cyv is still quite specific to the needs of codeyard. (If you’re a codeyard participant: be patient, it’ll be up mid june). However, if you’re interested, I’ll be glad to hear from you.

5 thoughts on “cyv: syncing git and svn”

  1. Cool. What’s the status of this this, it it usable yet? Here at work we have some subversion repositories that I have to use, but I prefer git. Right now I use git-svn, but this would be a nicer solution.

  2. Hello,

    Why `sync’ two repositories? Take a look at how git-cvsserver works. It allows you to check out data from a Git repository by using a CVS client.

  3. Simply because cvs doesn’t equal subversion. A subversion server emulator like git-cvsserver would indeed be the sweetest solution, but also would require a significant extra amount of work (and pain due to bugs) compared to the current solution of syncing.

  4. I saw a couple of similar git-svn based solutions. They all struggle from the issues related to concurrent access from Subversion and Git. git-svn also has a lot of quirks to deal with.

    GitHub is trying to implement something like git-cvsserver but for Subversion. Unfortunately, they’re far away from rock solid Subversion server. And their SVN support has too many limitations.

    So far, the best solution for this kind of server-side synchronization is SubGit, It’s hook-based system with its own conversion engine. It’s commercial product but it works just great.

Leave a Reply

Your email address will not be published. Required fields are marked *