开发者

Setting up Gerrit with a Git mirror of a Subversion repository

开发者 https://www.devze.com 2023-04-13 01:23 出处:网络
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 develo

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:

  1. A git mirror for the svn repository. The master branch on this is in sync with the trunk on svn.

  2. For each feature a topic branch is created. This is tied to Gerri开发者_如何学JAVAt, on which the review happens. Once the changeset is approved, Gerrit merges the topic branch back master.

  3. A gitweb, or similar, web application to view the repository on the browser.

  4. 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?


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:

  1. Set up your git clone on the Gerrit server
  2. Create an svn hook or a periodic task which will fetch from svn and push to your git clone
  3. Gerrit has a built-in version of gitweb, so you are covered there
  4. On the Gerrit server, create a change merged hook which will push back to svn

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号