SubGit Plugin for Gerrit
INFORMATION
Gerrit does not trigger standard pre-receive and post-receive hooks when one pushes new commits to Git repository. SubGit heavily relies on those hooks in order to maintain reliable two-way mirror. On this page you can download SubGit plugin for Gerrit that emulates pre-receive hook behavior.
1. Download SubGit Plugin for Gerrit
Version: 1.0.0-EAP4, published on: August 18, 2016:
MD5 checksum: 3902cf714c856524e8f4815ad70c00f3
Compatible Gerrit versions: 2.9.x, 2.10.x, 2.11.x and 2.12.x.
2. Install SubGit Plugin into Gerrit
Move downloaded file into GERRIT_SITE/plugins/ directory and make sure the plugin becomes enabled at Plugins | Installed:
If you have older version of the plugin, replace it with the newer one. We recommend to restart Gerrit after upgrading previously installed version of the plugin.
3. Increase receive timeout
Set receive.timeout to 0 in GERRIT_SITE/etc/gerrit.config file and then restart Gerrit server:
$ git config -f GERRIT_SITE/etc/gerrit.config receive.timeout 0
$ GERRIT_SITE/bin/gerrit.sh restart
By default Gerrit may interrupt git push
operation on timeout, setting receive.timeout to 0 forces Gerrit to wait until SubGit completes Git-SVN synchronization.
4. Create empty Git repository
Create empty Git repository at Projects | Create New Project:
5. Follow standard instructions
Locate repository directory of created Gerrit project:
$ ls GERRIT_SITE/git/
$ ls GERRIT_SITE/git/project.git
and follow standard instructions on establishing Git-SVN mirror with SubGit command line tool:
Run the following command to configure Git repository to mirror SVN project:
$ subgit configure --layout auto SVN_URL GERRIT_SITE/git/project.git
Above command will detect branches layout in the SVN project and generate SubGit configuration file ready for further adjustments. You may be asked for credentials unless those are already stored in the SVN credentials cache at ~/.subversion/ directory.
Review and adjust branches mapping configuration:
$ edit GERRIT_SITE/git/project.git/subgit/config
Review and adjust Git/SVN authors mapping:
$ edit GERRIT_SITE/git/project.git/subgit/authors.txt
You may use dynamic authors mapping replacing authors.txt with a script. Script sample could be found at GERRIT_SITE/git/project.git/subgit/samples/ directory.
Run the following command to enable mirror and translate SVN revisions to Git commits:
$ subgit install GERRIT_SITE/git/project.git
As soon as initial translation is completed, Gerrit project is ready to serve users. Commits pushed to this project will be translated to Subversion repository and SVN revisions will be translated to Git.
6. Get Support
Would you have any question on using SubGit with Gerrit, don’t hesitate to contact us at support@subgit.com. We’d be glad to assist you.