At work, we currently use Subversion for SCM. I have set up a local git-svn mirror and use that as my primary development workspace. I am comfortable with the basic functionality now. One other developer in the team also wants to move to Git, so we are considering using a git mirror of the svn repository. I would also like to try Gerrit alongside this exercise.
The setup I imagine is something along these lines:
A git mirror for the svn repository. The master branch on this is in sync with the trunk on svn.
For each feature a topic branch is created. This is tied to Gerrit, on which the review happens. Once the changeset is approved, Gerrit merges the topic branch back master.
A gitweb, or similar, web application to view the repository on the browser.
A similar process for other branches on subversion besides trunk.
Essentially, what I want is that I interact only with my local git clone and the Gerrit webapp; pushing the reviewed changes back to svn should happen automatically. How do I go about setting up something like this?
Navigate to the repository you just cloned. Pull in the repository's Git Large File Storage objects. Mirror-push to the new repository. Push the repository's Git Large File Storage objects to your mirror.
git-svn is a specialized tool for Git users to interact with Git repositories. It works by providing a Git frontend to an SVN backend. With git-svn, you use Git commands on the local repository, so it's just like using normal Git. However, behind the scenes, the relevant SVN commands are sent to the server.
You can clone from a SVN repo using the git svn clone command. -s = If your SVN repo follows standard naming convention where main source is in “trunk”, branches are created in “branches”. Here we are telling git svn that trunk is the “trunk” directory, maintenance is the “branches” directory etc.
Unfortunately it isn't possible to do this all automatically (at least, not without a lot of work). Here are some steps which can get you close:
Like Greg mentioned above, when step 4 fails things will be tricky. You'll have to reset the git repository in Gerrit to match svn and re-submit your change. This will be much easier if/when you convince the rest of your team to drop svn and use git/Gerrit :-)
Good Luck!
It's possible to setup a Git mirror that be in sync with the repository SVN
Install SubGit into your SVN repository:
$ subgit install path/to/svn/repository
Then just setup access to the linked Git repository created (path/to/svn/repository/.git) using Apache or whatever. Every push to that Git repository will be translated to an SVN revision and vice versa.
So you may use the linked Git repository in Gerrit and for you team (as if SVN never existed). After that you may shutdown SVN repository (or continue using). To stop synchronization before shutting down run:
$ subgit uninstall path/to/svn/repository
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With